I recently changed the hardware I use for running RISC OS from my old Iyonix machine to a nice new ARMiniX, which is based upon the PandaBoardES. The main advantage of this new machine is that it is faster and more capable in various ways. Here I want to deal with one particular aspect of that and how I set out to get optimum audio quality. Much of what follows was aimed at this new hardware. But the circuit I describe may well be useful for others who wish to listen to audio from other computer hardware via its inbuilt analogue outputs.
When it came, the ARMiniX was the first computer hardware I’d even found that would run RISC OS (RO) and was capable of playing audio material at the 88.4k and 96k sample rates that are becoming more popular amongst audiophiles. You can choose to have the sound hardware work at any one of the rates – 44.1/48/88.4/96k. However there is currently a problem with using the 44.1/48k system rates even though those would seem the obvious choice when playing 44.1/48k source material. Fortunately, x2 resampling is about the most benign and easy resampling process to perform. So I decided to use 88.2k system rate to play both 44.1 and 88.2k source material, and 96k for 48 and 96k material.
Figure 1, above shows some examples of the results I obtained when playing a moderately demanding test (LPCM wave) file of a 5kHz + 6 kHz two-tone waveform. The red and blue lines whow the output for the Left and Right stereo channels. For the tests shown I only had the two-tone waveform on one channel. The other shows what you get when a channel should be silent.
The upper graph shows the result when playing a test file that has a 44.1k sample rate. You can see some clear added tones in the ultrasonic region that are 5 and 6 kHz either side of 44.1 kHz. These arise because the standard current RO resampling method is simple linear interpolation. This tends to produce such unwanted ‘aliasing’ image tones. The lower graph was obtained whilst I played a test file of the same pair of tones, but the test file had an 88.2k sample rate. If you compare the two graphs in Figure 1 you can see that when playing an 88.2k rate file these ultrasonic aliases vanish. In fact, when the ARMiniX plays 88.2k material with its system rate set to 88.2k the result is pretty clean. (Similarly, it plays 96k source material very well if the system rate is set to 96k.)
The good news is that when the source - system rates have a simple x2 ratio the added aliases always appear in the ultrasonic region. Hence if you play 44.1k source material with a 88.2k system rate, or 48k source material with a 96k system rate they aren’t obviously audible. But they may be a problem nevertheless. e.g. they may upset a speaker or headphones or some other following equipment. So any unintended ultrasonic components are best avoided.
The second feature that is clear from Figure 1 is the presence of a ‘noise hill’ that shows up in the region above about 30kHz. This may not look much due to the log-scaling of the frequency response. But if you measure the output with a wideband rms meter you find that the total amount of ultrasonic noise or ‘hash’ this ‘hill’ contains actually comes as high as about -40dBFS. i.e. comparable with the level of a lot of classical music! So again, although it can be put into the ‘mostly harmless’ category, it would be better to remove such unwanted ultrasonic hash.
Given the above I decided that some form of passive analogue filter stage after the DAC output from the ARMiniX looked to be a good idea. That in turn implied also having a ‘buffer’ stage so that the filtered output could still drive headphones (or the input to a hifi amplifier). At this point I also had another factor in mind...
It is quite common these days for someone playing music using a computer to use some kind of ‘volume control’ provided by their playing software or the computer’s operating system. This can be fine, but can also lead to problems and degradation of the sound quality. In particular, if you wind down the volume a lot you may be converting 16bit input samples down to use far fewer bits per sample. If the volume processing isn’t ideal there may also be added quantisation distortions.
For this reason – unless the volume adjustment and following processes use 24bits (or more) – it may be better to leave the digital signals at relatively high level, and only have a volume control after the DAC. So having decided I wanted a filter and active gain stage, I decided I might as well also include ye olde fashioned volume control as part of the added circuitry.
After some experiments I settled on a basic design whose circuit is shown in Figure 2, above. In fact I based this on the same cheap (less than ten pounds) Velleman kit I’ve used for some previous headphone amplifiers. This means you get almost all the headphone amp components, including the PBC in a bundle. Although you then omit/change some components to make the above circuit. (The red and blue labels in Figure 2 are the part numbers of the circuit locations on the Velleman PCB.) This makes things easier as you don’t have design a complete PCB of your own. But note that the cheap kit’s PCB isn’t very well made, so you may find some of the pads aren’t connected correctly to the tracks!
For the sake of convenience I powered the amplifier with a set of six AA cells. These give about 9V dc for the +ve rail and seem fine. You can use lower voltages down to about 4 V (i.e. about 3 AA cells) but this tends to limit the maximum output level a little.
By feeding the ARMiniX audio output though the added filter/volume control/amplifier the result becomes like as shown in Figure 3. Here I used the same 44.1k input test file as for the upper graph of Figure 1, and had the system rate set to 88.2k as before. You can see that the unwanted aliases around 44.1k have gone. You can also see that the noise hill is also much smaller than before. In fact, I shifted the range of levels displayed so you can now see down to below -110dBFS. So this measurement is actually more sensitive than the ones shown in Figure 1.
Figure 4 shows the output from the circuit when I played a wideband white noise test signal. You can see that the filter+amp has an almost flat response from 10Hz up to over 20kHz. But there is then a swift cut and frequencies around 40kHz or more are rejected by at least 40dB. So this filter does a decent job of passing the normal audible range whilst suppressing the ultrasonic aliasing and DAC chip hash. In effect, for x2 conversions the filter turns a basic linear interpolation into a result comparable with much better forms of digital resampling.
Unfortunately, these Toko filters aren’t easy to find these days. So at present I haven’t located a supplier in the UK. But there are other filter designs around which can also pass the wanted audio whilst reducing the unwanted ultrasonic additions. I write more on this when I’ve looked into the matter further.
The design I settled on has an inherent amplifier gain of (22 + 8.2)/8.2 = 3.5. However the Toko filter reduces the signal level by about a factor of 2. So by using the volume control I can wind the actual controlled gain from zero up to about 1.5. The ARMiniX will output a maximum level before clipping of about 1.04 Volts RMS. For the following tests I was using the six AA cells to power the amp. The maximum output levels you can obtain may be lower if you use fewer cells or have a lower rail voltage provided by some other means.
When I measured the output from the amp this gave an output of 1.48 Vrms, unclipped when the volume control was at maximum. When I connected a 34 Ohm load to simulate a typical headphone load the output level dropped to about 1.2 Vrms because of the 8.2 Ohm output resistance of the amplifier. At this maximum level the signal then showed slight clipping (about 0.5% distortion for a sinewave). This is because the amount of current was as much as a 5532P IC could deliver. If I wound down the volume control a small amount the output fell to 1.1 Vrms and lost any sign of this current-limiting induced clipping. Hence in practice the entire range of the volume control is available and the circuit can give any level from zero up to slightly more than the direct use of the ARMiniX into headphones or a hifi system.
For my circuit I used a 20kOhm Log-law Alps 25mm ‘blue’ pot as I regard these as good quality volume potentiometers. Electrically speaking, you could use any stereo pot with an end-to-end resistance of around 20kOhms or more. I’d recommend a log-law pot if you wish to listen on headphones. Otherwise you may be struggling to set a level with a linear pot wound almost down to zero!
The picture above shows the circuit I made. I put this into a box that I already had. It only had a 4xAA cell battery compartment so I attached some battery holders to it on top of the box. I also connected an on/off switch and indicator (a green LED in series with a 2k2 resistor.) As you can see I’m not that concerned about the appearance! But it works reasonably well. I intend to attach the switch and LED more tidily in due course. But I tend never to get around to such things...
Jim Lesurf
1500 Words
1st Aug 2013