Thursday, 5 May 2016

Game of Tag, or Have You Ever Met A Data?

Right, that's a CD ripped then. Now what?

CDs are hard to arrange on a shelf, because they are in a specific physical order that determines how you see your collection. One of the brilliant things about a disk-based collection is that in principle you can have any view you want of it, given that you've made a sufficient range of views possible!

And tags are how you enable those views. Or rather metadata, which includes tags. Artist, composer, track title, album title, genre... what do you want?

There are several online metadata repositories - FreeDB and MusicBrainz being the main freely accessible ones. XLD automatically looks up the ripped CD by a composite hash based on the track timings and offsets, which is usually sufficiently distinct, and sticks the data it finds in the ripped tracks directly. I've found MusicBrainz to be the most authoritative seeming source - it's peer reviewed, and people put a lot of effort into getting it right, with evidence for their entries required to support the reviewing and editing process. The data extends even to recording location and engineer - it's very rich. MB also provides a tool for looking up and tagging CDs and already ripped files - MusicBrainz Picard, which I've used to tidy up and expand the metadata on lots of previously ripped material.

But sometimes your CD is not in the database!! I've got a CD of Astor Piazzolla tangos, played by a piano trio, from SWR the German radio station. It's not in the MB database, in fact, one of the performers wasn't in there either. So I had to add it... and that was seriously non-trivial! They have a Style Guide, which extends to Classical material, loads of standards for everything, it's extremely daunting. And I forgot to add the physical evidence - I ended up taking pictures of the CD sleeve and case to provide the actual source of data, along with a link to the record company website and the SWR studio website. Let's hope it's enough.

Ripping yarns

Ripping... The bete noir of digital audio!

The one thing one needs to do if switching to a streaming setup is rip your CDs, unless your CD player has a digital output, which mine doesn't (thanks Naim!). Obviously, one doesn't want to lose quality or invest lots of time in loading them onto hard disk in a manner which later has to be redone. If it takes 10 minutes to rip a CD, 1000 CDs will take 10,000 minutes or a Bloody Long Time basically, not something that one wants to repeat!

So I've selected

  • FLAC as a format for home-ripped CDs; I'll probably accept other formats for HD downloads, but may even convert them to FLAC for easier consumption
  • XLD as the ripping tool
Sounds good right? Marv. But...

I started off ripping a couple of CDs. XLD produces a pretty thorough report on the quality of the rip, and it's pretty scary! 000s of block retries, jitter recoveries and the mysteries of AccurateRip!

It turns out that CDs are pretty flakey as a digital medium - which begs the question, "Why don't programs provided on CD fail because they have so many bit errors that the code is defective?". 

Anyway, AccurateRip has a database of hash values for tracks that people have ripped over time. The ripping program looks up the hash it's generated for the current track, and checks to see if anyone else got that value for the specific CD and track. Simples - online voting effectively! So quite a few CDs of mine seem to rip ok, but lots more don't... I end up with a disk with sometimes 0 AccurateRip-approved rips! What's that about?! And what do I do next? I've tried re-ripping, but that doesn't always work although there are sometimes improvements.

XLD does a test rip before the actual rip, and generates its own hash for each, and compares them. It also says if it gets an unrecoverable error, which fortunately none of my CDs has had. So, I basically re-rip the tracks that either don't get an AccurateRip OK or for which the test/live rips have different hash values. That seems to work pretty well, the test/live rip hashes often end up being the same after a few goes (!).  But still no AccurateRip OK. Hey ho. Would I ever get one? Who knows?

Here's a sample log, with my comments in bold:


X Lossless Decoder version 20151214 (149.1)

XLD extraction logfile from 2016-05-04 21:17:29 +0100

Thomas Dolby / The Flat Earth

Used drive : MATSHITA DVD-R   UJ-898 (revision HC10)
Media type : Pressed CD

Ripper mode             : XLD Secure Ripper
Disable audio cache     : OK for the drive with a cache less than 1375KiB
Make use of C2 pointers : YES
Read offset correction  : 102
Max retry count         : 40
Gap status              : Analyzed, Appended (except HTOA)

TOC of the extracted CD
     Track |   Start  |  Length  | Start sector | End sector 
    ---------------------------------------------------------
        1  | 00:00:00 | 04:56:63 |         0    |    22262   
        2  | 04:56:63 | 06:40:59 |     22263    |    52321   
        3  | 11:37:47 | 05:35:47 |     52322    |    77493   
        4  | 17:13:19 | 05:22:69 |     77494    |   101712   
        5  | 22:36:13 | 04:55:73 |    101713    |   123910   
        6  | 27:32:11 | 05:40:20 |    123911    |   149430   
        7  | 33:12:31 | 04:17:43 |    149431    |   168748   
        8  | 37:29:74 | 04:44:23 |    168749    |   190071   
        9  | 42:14:22 | 04:14:71 |    190072    |   209192   
       10  | 46:29:18 | 07:17:29 |    209193    |   241996   
       11  | 53:46:47 | 04:05:74 |    241997    |   260445   
       12  | 57:52:46 | 05:03:24 |    260446    |   283194   
       13  | 62:55:70 | 03:30:50 |    283195    |   298994   
       14  | 66:26:45 | 06:17:29 |    298995    |   327298   
       15  | 72:43:74 | 04:41:62 |    327299    |   348435   

AccurateRip Summary (DiscID: 002b925c-01e9d3d4-0312250f)
    Track 01 : OK (v1+v2, confidence 90/90)
    Track 02 : NG (total 88 submissions)
    Track 03 : NG (total 89 submissions)
    Track 04 : NG (total 87 submissions)
    Track 05 : NG (total 89 submissions)
    Track 06 : NG (total 89 submissions)
    Track 07 : NG (total 90 submissions)
    Track 08 : NG (total 87 submissions)
    Track 09 : NG (total 87 submissions)
    Track 10 : NG (total 88 submissions)
    Track 11 : NG (total 88 submissions)
    Track 12 : NG (total 87 submissions)
    Track 13 : NG (total 87 submissions)
    Track 14 : NG (total 88 submissions)
    Track 15 : NG (total 88 submissions)
        ->1 track accurately ripped, 14 tracks not  <--- Hmm, some work required!

All Tracks
    Album gain               : -3.33 dB
    Peak                     : 0.998871
    Statistics
        Read error                           : 0
        Jitter error (maybe fixed)           : 91
        Retry sector count                   : 100097
        Damaged sector count                 : 0

Track 01
    Filename : /Users/john/Music/The Flat Earth/01 - Dissidents.flac
    Pre-gap length : 00:02:00

    Track gain               : -1.59 dB
    Peak                     : 0.948547
    CRC32 hash (test run)    : 8F33E56F  <--- Hurray!!
    CRC32 hash               : 8F33E56F  <
    CRC32 hash (skip zero)   : 0C3F72AC
    AccurateRip v1 signature : 8D6FA5FD
    AccurateRip v2 signature : A2559C3A
        ->Accurately ripped (v1+v2, confidence 47+43/90)  <--- Even more hurray!
    Statistics
        Read error                           : 0
        Jitter error (maybe fixed)           : 0
        Retry sector count                   : 4   <--- That's pretty low...
        Damaged sector count                 : 0

Track 02
    Filename : /Users/john/Music/The Flat Earth/02 - The Flat Earth.flac
    Pre-gap length : 00:01:04

    Track gain               : -0.36 dB
    Peak                     : 0.998871
    CRC32 hash (test run)    : 7412B32B  <---- I'll take that...
    CRC32 hash               : 7412B32B  <
    CRC32 hash (skip zero)   : 40C7165D
    AccurateRip v1 signature : D2E5494B
    AccurateRip v2 signature : 76A99054
        ->Rip may not be accurate (total 88 submissions).  <-- No AccurateRip hit
    Statistics
        Read error                           : 0
        Jitter error (maybe fixed)           : 10
        Retry sector count                   : 9270  <-- Ooh...
        Damaged sector count                 : 0

Track 03
    Filename : /Users/john/Music/The Flat Earth/03 - Screen Kiss.flac
    Pre-gap length : 00:02:61

    Track gain               : -2.78 dB
    Peak                     : 0.878052
    CRC32 hash (test run)    : 812F557B  <--- Oh dear, think I'll try that again
    CRC32 hash               : 9CF1E8A0  <--- until it's consistent...
        ->Rip may not be accurate.
    CRC32 hash (skip zero)   : 7A14C203
    AccurateRip v1 signature : 283C5FEC
    AccurateRip v2 signature : A86C9E81
        ->Rip may not be accurate (total 89 submissions).
    Statistics
        Read error                           : 0
        Jitter error (maybe fixed)           : 17
        Retry sector count                   : 7771
        Damaged sector count                 : 0


Some inconsistencies found

End of status report

Wednesday, 4 May 2016

The office and a salutary experience

OK, time to sort out the "office". This is the small bedroom I used to use for work which has become something of a dumping ground for stuff from other rooms over the last 6 months when various rels and g-kids visited. I want to use it for a workroom to do things like this.

I dug out the RPi 3 that I'd set up with my own brew of MPD etc. rather than the Rune distro, which I'm using now. This is using the ODAC USB DAC, rather than the Pi-DAC+, which is already installed in the front room. Zapped the SD card with the Rune image, loaded it up, started ok, all good. However, I then started to configure it how I wanted it, and curiously the new values just wouldn't stick. I struggled and struggled, trying all sorts of things, rewriting the SD card etc. etc. I should have known when I couldn't rename the card "Rune" rather than "NO NAME"... It turned out that it was screwed - a symptom of a bad SD card is you can't write it! I found another one, used that, and all was well... by midnight! That's three hours I won't get back.

I'm currently playing it through some old Altec PC speakers with a dodgy subwoofer, which sounds ok. I'll replace these with the Wharfedale NXTs when I get a bit more space and sort the room out better.

I've named the two Rune installations "frontroom" and "office" which seemed sensible. They can be accessed using "frontroom.local" and "office.local" from any browser, mobile or PC-based. I've also tried UPnP data from the minimserver installation on my Mac, and also AirPlay from an iPhone, and it all works great. This could actually work!

Monday, 2 May 2016

More listening

I've now found some more cables, and connected the ODAC and iQAudio Pi-DAC+ simultaneously. Rune/MPD does a neat job of enabling them both to be connected and switched between with only a small interruption.

I'm now listening to BBC R3 streamed via wired Ethernet from the router. The sound is good on either, with room acoustics clearly audible. However, the Pi-DAC+ seems to be more open, listening to a live Wigmore Hall concert. But it's a tough call!

The DAC+ has a much wider range of acceptable digital formats, which given my desire for a "hw:n,m" use i.e. straight-through no pre-processing or resampling, makes it more useful.

ALSA information from the pair of devices is shown below

2) Analog alsa audio output interface `hw:1,0'
 - device name       = IQaudIODAC                                                  
 - interface name    =                                                             
 - usb audio class   = (n/a)                                                       
 - rates per format  = S16_LE:             32000Hz 44100Hz 48000Hz 88200Hz 96000Hz 176400Hz 192000Hz 
                       S24_LE:             32000Hz 44100Hz 48000Hz 88200Hz 96000Hz 176400Hz 192000Hz 
                       S32_LE:             32000Hz 44100Hz 48000Hz 88200Hz 96000Hz 176400Hz 192000Hz 

 3) USB Audio Class Digital alsa audio output interface `hw:2,0'
 - device name       = ODAC-revB                                                   
 - interface name    = USB Audio                                                   
 - usb audio class   = 1 - isochronous adaptive                                    
 - rates per format  = S24_3LE:             96000Hz 88200Hz 48000Hz 44100Hz 32000Hz 
                       S16_LE:              96000Hz 88200Hz 48000Hz 44100Hz 32000Hz 


***** Later *****

I've rigged up a pair of ancient* Wharfedale NXT panel speakers with their subwoofer in the same room, and connected the ODAC via a Myst TMA5 amplifier I had lying around. Not for a DAC comparison, but just because I could and because I'm thinking about using them in my office when it gets sorted out. Using the RPi + DAC setup to play whatever I feel like there from the putative library would be great!



* Ancient?! Hardly - the Quad ESL63s I'm listening on are nearly 35 years old... and been rebuilt at least twice!

Sunday, 24 April 2016

IQAudio I2S Pi-DAC+

I received this a while back but had not had time to set it up previously.
IQAudio Pi-DAC+

Setup

I had a new RPi3, set it up with Rune which is a Volumio equivalent on a different Linux platform (ArchLinux - only 32 bit) but already compatible with Pi3. Works wonderfully well, doing everything  I set up for myself with MPD etc. in a flash. The Pi3 built-in wireless works a treat, but has crappier reception than the USB plug-ins.

Rune does UPnP OOTB, so I was able to test with the headphone output and the MinimServer on my Mac as a music data source. Very impressive that it all worked perfectly in a stress-free manner.

Plugged the DAC+ into the RPi GPIO pins no problem, using the supplied stand-offs and screws. Powered up - recognised immediately by Rune interface, told it to use it.

Plugged my USB drive into the RPi, restarted things. Drive and music recognised, Rune UI showed Library updating. All good.

Evaluation Approach

My approach to evaluating DACs is simple.

  1. Plug the DAC for evaluation into the Disc2 input of the Chord pre-amp
  2. The Naim CD2 is meanwhile plugged into the Disc1 input
  3. Disc1 and Disc2 have the same gain setting - this makes sense as long as the DAC and Naim have the same nominal output, I check this in the specifications
  4. Using the 80s vintage HiFi News Test Disc, which has some very nicely recorded music on it, play the same track on both my Naim CD2 and the DAC, starting at approximately the same time
  5. Switch between Disk1 and Disk2 using the Chord preamp remote control, sitting in the main listening position 
This allows me to A/B the two sources pretty easily, and when there's an interesting bit, switch conveniently from one to the other. "Interesting" usually means spatially amusing, or transiently brisk.

Observations

In isolation, the DAC sounds fairly bright, and does have space around instruments. I've only listened to some classical at this point, including some Hildegarde of Bingen, as that is probably more critical than most rock in respect of the factors I'm interested in i.e. soundstage, spatial location, "air", timing.

Listened to against the Naim, the Naim sounds dull initially, and not so immediate, almost boring. However, listen harder and for longer, and the acoustic of the Naim sounds deeper and more detailed. The instruments sound woody, and less brazen, sibilant. This is on only two tracks so far, so it's a bit unrepresentative, so more listening to do.

At this point, I'd not swap the Naim out for this DAC. at least, not for the main stereo setup.

I also have to compare this to the ObjectiveDAC (a USB-connected unit) - I'll be able to do that from the Pi directly, as it allows for both to be plugged in at the same time, and switched between. Cables are a bit of a problem as I don't have two identical sets of RCA cables, so I'll have to try with one setup and then switch the cables and try again.

How much have I allowed Rob Watts' presentation to influence me? Quite a bit probably, but then, he is a long-time listener and digital dude, so that's not necessarily a bad thing. Of course, I'd like to hear Mojo/Hugo/Dave in this setup. Maybe I can if I nip along to Audio-T...

Digital Audio Principles and Techniques

Digital Audio Principles and Techniques

This page is just a place to keep some notes about various concepts that appear to be important in the sonic quality of digital audio processing. It's been triggered by the excellent presentation by Rob Watts, Chord Electronics' digital audio consultant responsible for Hugo, Mojo and Dave. He uses lots of terms which I didn't really understand, and it's in the interest of grasping the DAC process that I started this investigation.

Noise Shaping

One of the effects of quantisation is noise i.e. the difference between "reality" and the numeric representation of that reality manifests itself as random noise. Example: Assume allowable values in digital system are 0-9; sample at time t has value 5.4, which is quantised to 5. The difference (0.4) will manifest itself as noise, and clearly varies randomly (or is it random??) across samples.

Reducing bit depth i.e. the number of bits being used to represent a signal [not yet sure why you'd want to do this - seen it referred to as part of DAC construction/design] results in quantisation noise also, however, by using a feedback loop such that the noise value for the preceding re-quantised sample is used to alter the quantisation of the current sample. The way in which the feedback is applied can be used to "shape" the energy spectrum of the noise, such that although the total energy is the same, the visible/audible/perceptible effect is reduced because the energy is lower in the more sensitive areas. Phew. Cool though.

See this Wikipedia entry for more specifics.

Dither

Actually, quantisation error is not random... It generates harmonics i.e. non-random distortion. Adding random noise of some spectrum to the signal prior to sampling makes the noise more random, and reduces the maximum level of the distortion/noise, although again I suspect the overall energy is constant.

1 Bit Conversion (!)

It's easy to understand multi-bit e.g. 16 bit ADC. Conceptually, the analogue signal is a continuously fluctuating voltage. The voltage is measured at the "sample rate" e.g. for Red Book CD 44.1k times/sec, and the resulting measurement is "quantised" to the current bit depth i.e. to fit in the number of possible values. So for 16 bit audio, the value can vary between 0 and 65535 i.e. 0 to 2^16-1. So how would a 1 bit ADC work?! I've always struggled with that...

Apparently, by using a colossal sampling rate e.g. 2.4MHz in the case of DSD, and 1bit (with a dynamic range of 6 dB!), then doing (serious!) noise shaping to push the noise out of the 20-20kHz region into the ultrasonic, you can get > 100dB SNR/dynamic range. However, it is hard (impossible?!) to add reasonable amounts of dither in the feedback loop in the pure 1 bit case, so most realistic systems use more bits to enable better and more effective dither. Sounds like DSD is crap to me... Fundamentally flawed. Especially as it gets turned into PCM anyway...

Decimation

The process of reducing the bit depth or sampling frequency, for whatever reason. Interestingly, this requires two steps
  • Reduce high-frequency information so that fmax is < new sample rate; this is to prevent aliasing in the resulting digital output; this can be done with a digital filter, using IIR or FIR techniques
  • Resample the data i.e. chuck away all the unwanted bits/samples
Obviously this reduces the effective bandwidth and dynamic range, but you'd expect that. Rob Watts describes using downsampling as part of the DAC process, not sure why yet, maybe it's to simplify the conversion i.e. by requiring fewer steps.

[Infinite|Finite] Impulse Response Filtering

Digitally represented signals can be filtered for frequency response i.e. low/band/high-pass filtered using two approaches
  • Infinite Impulse Response
  • Finite Impulse Response
Analogue electronic filters are necessarily IIR i.e. their components always retain some trace of an impulse input in their state. Thus capacitors retain some charge, however long you wait (although admittedly vanishingly small) and this necessarily impacts the working of the filter.
The presence of feedback in a digital filter generally creates an IIR filter and its "z domain transfer function" contains a denominator in its sequence of terms. An FFR series contains only a numerator. 

Friday, 25 March 2016

Thinking so far...

My thoughts on potential technologies at this point are:
  • Disk store
    • Dunno yet! Ideally, I'd like something very quiet. Should I conflate the audio and other possible stores e.g. films, photos? 
    • Synology, other RAID off-the-shelf kit, but if so probably one that will support running a media server
    • A simple RAID box - loads cheaper, + a lightweight computer to run the media server (RPi?)
    • Initially, a USB disk attached to a RPi!
  • Media Server
    • Looking at uPnP, largely because it's there, not sure I have really looked at the alternatives
    • I quite like, and am running, Minimserver, not least because its tagging is supposed to be useful for classical, and it runs on NAS boxes if/when there is one (it's Java)
    • Update: I've now installed and run Rune, which is a Volumio-alike but based on a different Linux (ArchLinux 32 bit), and which runs on RPi3 just fine. It's very good, and does everything I want with no installation stress or problems. Lovely!
  • Renderer platform
    • Currently working on RPi 3
    • Provided we go with Open Source, then it can run on lots of platforms
  • Renderer software
    • Initially examined volumio, but 1.55 doesn't run on RPi3, although v 2 might Real Soon Now
    • Currently working with mpd, which is the basis of volumio anyway
    • Incorporated upmpdcli, which provides a uPnP interface to mpd
  • Control software
    • Linn Kinsky loaded on phone and Mac, not very impressed so far!
    • Not looked at others yet
  • Speakers
    • Linkwitz LXMini
      • These use a miniDSP DSP 2x4 to implement the active crossover; this is available in a box or kit
      • If a kit, could be driven at 24/48k directly, but then needs a miniDigi to enable this; however, that is SPDIF/TOSLink in only, and then does sample rate conversion to 48k, using an Asynchronous Rate Converter chip
      • Potentially, might be worth looking at the miniDSP 2x4 HD kit, since it could be driven directly in digital, skipping a DAC/ADC step to get data into the DSP
    • Amps - now there's a question... Since I need 4, around 50w, there are a few options
      • Re-use: Chord 1200C + Myst TMA5? Quad 405-2 + another from EBay?
      • Buy - Thomann 4 channel power amp? £180 ish
      • Buy - just missed a NAD 916 6 channel 70w/channel amp on EBay - £80! Although someone is selling NAD 906 (same thing) for £140 cash hmm. 
      • Build - vast array of options!
        • Chip Amp LM3886 derivatives
        • Audiophonics - loads of options on there, including some interesting Class D (€40 per 2x100w amp, SMPS maybe €100, other parts whatever), but still expensive compared with Thomann!