I don’t know how you think about it, but in my opinion computer-science is not an exact science. Without getting murpyh’s laws involved, we can safely assume that when you think something will work, simply it will not. Or it will do in a unexpected way.
To minimize this common rule, while starting this project, we should examine the hardware itself, taking every predictable aspect into account. Dear practictioners, welcome to today’s lesson: Anatomy of a Pi.
As you can see from the picture above, these are the main components of a Pi board. We’ve got 2 usb ports, lan, analog audio and s- video, micro usb power socket, sd card slot and hdmi out. The cpu, gpu and ram are in the middle of the pcb (images from wikipedia)
What does it all mean for all project?
First caveat: our goal is to stream hi-quality, hi-res, jitter free audio out of usb ports (while studying how to implement a serious dac via i2s whit the gpio pins). Here starts our first problem. As you certainly now, one of the Audiophilia Hysterica diagnostic cryteria prescribes that if usb bus is dedicated to stream audio to a dac or transport it only should do that. No usb storage then. No usb bluetooth adapters and so on. So, keep in mind, that connecting a usb storage drive, while using a usb transport will affect your audio reproduction. At least, that’s what we’re told everyday, no?
These happens for 2 main reasons:
1- electrical “pollution” from spinning drives. Your hard drive electric noise will affect also the dac, if that’s not galvanic isolated from the usb port you’re using
2- lot of i\o in the usb bus. This will prevalently mean jitter.
Then, you can imagine why audio purists usually tend to avoid usb transport. And here, for our project, there is some serious issue.
The ethernet connection of the Pi is done via an USB to ethernet connection.
Quite bad, isn’t it? This practically means that even if we use Ethernet access our music library (to a NAS for example) we’ll share the same bus of the dac\transport. That’s why it will be extremely important, for quality and jitter reasons, to find another way to connect to our dac. How? Via the gpio pins (Wikipedia)
General Purpose Input/Output (GPIO) is a generic pin on a chip whose behavior (including whether it is an input or output pin) can be controlled (programmed) by the user at run time.
GPIO pins have no special purpose defined, and go unused by default. The idea is that sometimes the system integrator building a full system that uses the chip might find it useful to have a handful of additional digital control lines, and having these available from the chip can save the hassle of having to arrange additional circuitry to provide them. For example, the Realtek ALC260 chips (audio codec) have 8 GPIO pins, which go unused by default. Some system integrators (Acer Inc. laptops) employing the ALC260 use the first GPIO (GPIO0) to turn on the amplifier used for the laptop’s internal speakers and external headphone jack.
Basically, we can add a custom port delivering a specific output coded in a specific way. My intent is to deliver audio stream via i2s, connecting directly the Pi to a DAC. This functionality was initially available in first revisions of the Pi, but it was dropped in the final release as you can read here. No worries then, even if this appears as a serious challenge, someone has managed to get it running.
So, now you know. For simplicity sake, you can use USB connection to your Dac\transport. If however you would want to have the best quality you can get from RaspyFi, you should wait until we sort out how to safely get i2s stream to a DAC. That will also mean that the path connecting the PI to our DAC should be extremely short, as the i2s standard requires the connection not to be than 3 cm longer. So PI+DAC in the same case. I think that will definitely worth the hassle of the extra job.
A brief example of how to use GPIO Pins
[embedplusvideo height="337" width="550" standard="http://www.youtube.com/v/q_NvDTZIaS4?fs=1" vars="ytid=q_NvDTZIaS4&width=550&height=337&start=&stop=&rs=w&hd=0&autoplay=0&react=1&chapters=¬es=" id="ep3488" /]
My intention is to use the Famous AK4396 DAC , something like this. Obviously, with custom audio output (tube one?). A smart guy on T-forum has managed to get it connected to XMOS via I2s. Thread here. Hope we’ll do something similar.
Suggestions? Critics?
Pingback: jonniol6