Friday, 27 March 2015

Raspberry PI with balanced output

As a sound system designer you will, at some point, need a source to test your endeavors.
Apart from saying 'test one two...'  for hours on an end in a torn SM58 microphone one could also use some music.
More pleasant for the people around you and you will have the added advantage of having your hands free to twist those nobs..;)

Those soundguys being around a bit longer might remember the confusion when CD arrived. Away with the crack rattle noise and buzz from these LP's (let alone cassette copies) and hey, wow, what a clear definition, but wait a sec, what is going on in the top-end?
However the method of testing and tuning your sound system with your favorite CD became a world wide spread practice.

Now fast forward: we are in the 21st century, skipping Cd's are obsolete and a lot of people will use their ipad/pod/tunes to perform their tunings.
The lot of them will have some doubt regarding the quality of mp3 and advocate the one and only use of wav (or flac for our open source friends).

Certainly, we too have been using some CD's and a 'high-end' hifi CD-player  to do our system tuning.
But, although we never did a serious investigation, we always had some suspension regarding ripped CD's playing from some OS through some USB interface.

Now enter the realm of playing music from your computer.
First you will notice that it really does matter a lot what brand of interface you will be using. In pro-audio the most common solution will be some RME interface (pricey!)
If you investigate that route further you will notice that it also does matter a lot what player (read codec) you will be using: foo-bar being one of the more popular as opposed to anything like 'windows-something-player'.
Being on this route you will also find out that you have to bypass all OS based up and down sampling, Wasapi might be a solution in a windows environment.

I decide to take an other route:
Linux.

On several instances through this blog you will find pointers, a year ago or so f.e. I started to write a (never finished) walk through in setting up a headless music player.
Now let me try to round it up:

Raspberry PI running Volumio with balanced outputs



Well, with 5 million of these boards sold, one can presume that you have at least heard of Raspberry PI.
Rpi is based on one these so called S(ystems) O(n a) C(hip) running a linux based OS.
Actually at first marketed as a entry level platform for children to get to know programming it seems that these nice toys are becoming very popular with grown ups. Ahh, well, toys for boys I guess..
On a zillion places on the internetzz you can find information and howto's on operating a Rpi.
Let us concentrate on running audio.

First of all the on board audio chip really sucks, so first thing to establish is to get your audio data of the board in a proper way.
Now you could use some sort of usb based device, maybe even the above mentioned RME DAC's, but I had a lot of trouble running bigger data streams (24bit/96k) across the combined USB/ethernet interface.
Apparently just not up for the task.

A different route only recently opened up by using the i2s protocol on gpio ports.
Several people have been making nice add-on boards that sit on top of your RPI.
Here is three of the boards I tested:
Wolfson

Duriosound

Hifi berry digital

The 4th is a board from Hifi berry and puts out analog.
All these boards perform similar. (no, this is not turning out to be a board shoot out ;)
For the story we will continue with the latter:

modded HifiBerry analog in place

As has been mentioned before and over: two things of importance in 'bit perfect' reproduction of digital audio:
1.  no interpolation by up, down or oversampling and no arithmetic functions like 'replay gain make up' or any other mockery should be happening between your audio file and your D/A converter.
2.   clock should be as stable as possible.

For the first we trustfully use MPD playing audio directly through ALSA (i2s). Volumio is a very nice Linux distribution which takes care of all these software nooks and crannies which are explained in other places. Just google the key words.
The second is a bit less documented, you will find people arguing against RPI because to derive a sample freq. from 44100hz you need a fractional division of the RPI 's clock freq..not so good..
48k / 96k should not give you that set back.
Do I feel that as a big problem?
nah.. Remember we are talking a 100 euro device here so don't expect 1K+ euro performance!

But let us try to get a clean clock signal in the first place.
The guys who really know things about digital audio like Guido Tent (Tentlabs) or Eelco Grimm (Grimm clock) have whispered PSU in my ear.
So first step in improving the basic setup was to get rid of the wallwart switched mode usb psu:

linear PSU using LM7805 with 2N3055
Very simple linear PSU with the well known LM7805. To boost the current a bit I used a parallel 2N3055 (think 70's for sound ;)
All very well known basic techniques.
I did use a mix of some fine electrolytic capacitors in a experimentally achieved witchcrafted constellation, though...


Next thing to do is to make a balanced output.
Pro-audio guys really hate unbalanced signal transport: introduction of rattle and hum being the most mentioned spoilers of the party.
But what if a asymmetric transport is anyway a fundamentally wrong concept?
Treating 'earth' like something solid might be a right concept in high voltage power distribution, but  is completely wrong in signal transport (imho).
Naturally it takes 2 conductors to transport a signal and they are both equally vulnerable to the introduction of all kind of disturbances.
Gold plating or Teflon insulation of a single conductor does not help in any way.

Here is a picture of the circuit with it's separate dual 15v PSU:

unbalanced to balanced with That1646 and TL051 driver
The TL051 preamp is selected from a range of opamps using the still 'golden ears' of my 13 year old.  :)
Being past 55 I think mine have been deteriorated  to iron/lead/wood by now.
Remarkable sensation, knowing it's there but not being completely sure, like looking through a stained glass window.
Oh well, experience replace the loss (I hope).

Lastly a picture of the finished 'product' in a vintage AKG phantom supply box :