As a writer, I have long harboured a dream that one day an editor will buy me a top-of-the-range audio analyser, and I can set up an audio test lab and write pieces debunking the spurious claims made by audiophiles, HiFi journalists, and the high-end audio industry about the quality of their products. Does that amp really lend an incisive sibilance to the broader soundstage, and can we back that up with some measurable figures rather than purple prose?
An Audio Playground You Didn’t Know You Had
Sadly Hackaday is not an audio magazine, and if Mike bought me an Audio Precision he’d have to satisfy all the other writers’ test equipment desires too, and who knows where that would end! So there will be no Hackaday audio lab — for now. But that doesn’t mean I can’t play around with audio analysis.
Last month we carried a write-up of a Supercon talk from Kate Temkin and Michael Ossmann, in which they reminded us that we have a cracking general purpose DSP playground right under our noses; GNU Radio isn’t just for radio. Once I’d seen the talk my audio analysis horizons were opened up considerably. Maybe that audio analyser wouldn’t be mine, but I could do some of the same job with GNU Radio.
It’s important to stress at this point that anything I can do on my bench will not remotely approach the quality of a professional audio analyser. But even if I can’t measure infinitesimal differences between very high-end audio circuitry, I can still measure enough to tell a good audio product from a bad one.
Making An Audio Analyser From A Software Defined Radio
For my ersatz audio analyser I decided to keep it pretty simple, and measure only the total harmonic distortion, or THD. Strictly speaking I’m measuring THD plus noise, but in the context of experimentation this does not concern me. THD is expressed as a percentage, and it’s generally best thought of as the percentage of the signal emerging from a device under test that is due to the distortion present in the device. Thus a theoretical perfect device has a THD of 0%. The simplest way to measure THD is to inject a single frequency on the device input, then to divide what remains on the output when that frequency is filtered out by the component of that frequency present on the output. This requires a set of extremely good filters, hard work in analogue circuitry but a simple task in GNU Radio.
The flowgraph I came up with is a pretty simple one: a low pass filter cuts off just above the injected frequency while a high pass one cuts in just above that to give me the harmonics. Then it’s a simple case of mathematics to derive my % THD reading.
I’m using opposite channels of my stereo sound card as input and output, and if I hook them directly together I retrieve a THD figure with a 1kHz input of 0.0024%. Thus I’ve measured the THD of a Dell soundcard, and while it’s not as bad as it could be, for comparison a unit pitched at audiophiles would boast an extra couple of leading zeros. But of course, I haven’t just measured the THD of the soundcard.
While in theory the all-digital signal path of GNU radio is distortion-free, in fact it introduces distortion of its own. There is quantisation distortion, and distortion induced by imperfections in the filters, and then of course there is noise coming from whatever else a computer running a multitasking desktop operating system is doing. A good example came when I took the screenshot of the flowgraph, immediately the THD jumped by a factor of ten for a short time. There is a really good reason why that professional audio analyser costs so much, and why we don’t use commodity soundcards to do the job instead.
Are Gold Cables Really Better?
Having an audio analyser to play with, albeit a not very good one, I cast around for a test subject to try with it. The obvious thing to do was to try a comparative test, and so to that end I dropped in a couple of orders for cables. Is there any truth in the claims of upmarket cable manufacturers, or is it simply snake oil designed to part the customer from their hard-earned?
I picked up a pair of 3 ft USB cables, extremely different ones from opposite ends of the market. One was a £4 ($5) Amazon Basics cable such as the one you are probably using to charge your phone, while the other was a £99 ($123) Gold Reference Series cable from Grundlagen Audio in Germany which its manufacturer claims through its gold plated Active Quantum Nanoparticle construction delivers an exceptionally low THD for digital audio transfers compared to that of conventional cables. What could I do, but hook each cable up in turn and give it a go?
Out of the box, both cables were of near-identical length and weight, but the Grundlagen was noticeably stiffer than the Amazon cable. Probably all that extra gold isn’t as flexible or something. I used the flowgraph linked above, but with a USB sink and source replacing the audio ones. I’d expect the THD figures to be significantly lower with this arrangement because of course I will have removed my poor-quality sound card from the equation. So in with the first cable, starting with the Amazon Basics cable in a loopback from USB port to USB port. Immediately I was able to measure a respectable THD at 1 kHz of 0.00014%, not surprising given the lack of a sound card. Very good, but what about the cable costing twenty times as much? In went the Grundlagen, and straight away the difference was clear with a 1 kHz THD of 0.00007%, half that of the Basics cable. Can you hear a difference when the number is that small? Probably not, but it does prove that a gold cable is better than a grey one even if they sound the same.
The folks at Grundlagen were kind enough to share a video with us showing how they manufacture their cables. Meanwhile should any of you wish to take the idea of an audio analyser in GNU Radio any further, we’re all ears.