This episode is about digital audio.
Disclaimer (sort of):
Be aware that this post is not self-contained. If you haven't seen the video, you probably won't get much out of this reading. Also, this is not a tutorial on how to build a carpc like the one I made. For that, I'd need much more time and space. I just want to document the thought process behind a few hardware and software choices, share some techno-ramblings, and provide you with some links to get you started using the components I used.
Have you ever modified your car with custom electronics? Are you planning to hack a Raspberry Pi into a device that was not intended to be modified? Have you ever started a simple project (such as adding music to your car), and somehow turned it into a huge, titanic undertaking?
Digital audio
The name of the game here is "signal integrity".
In its perilous journey from the Raspberry Pi to my car radio, the audio signal will suffer quite some degradation due to the conversions performed by the FM transmitter, losses in the transmission medium, interferences with other signals, imperfections in the FM modulation and demodulation, and more. Ah, that poor signal....
It is then understandable why I don't want to use the standard audio jack on the Raspberry Pi, isn't it? No? Well the Pi produces audio using Pulse Width Modulation, or PWM for short. PWM is a ridiculously cheap way to produce an arbitrary waveform, and it is often used to produce audio. Unfortunately, "ridiculously cheap" rarely comes with "good quality"... And PWM is no exception.
Generating analog signals (red) with PWM (blue). |
PWM audio is affected by sound artefacts, and by a constant humming noise that cannot be removed. I already expect sound quality degradation from the FM transmission, and I really do not want to add another source of noise. The solution turned out to be quite simple. The Raspberry Pi supports digital audio via I2S, which is part of the GPIOs of the Pi. The only thing I had to do is to find a Raspberry Pi "sound card" capable of receiving digital audio, and producing a faithful analog representation of it.
iQaudIO Pi-DAC+. |
I'm not an audiophile, but I can testify the difference is really noticeable! I'm really glad I got this device for my carpc.
Have fun,
Kradion.
Hi there,
ReplyDeleteSaw your video on youtube. And this is almost the thing I want to build in my car. I just don't have a radio and really want to use the Pi as a radio. Now I see that you used a transmitter and your radio is basically just a pass through for the audio. But is there a way to by pass the radio and use only the Pi connected to a DAB+ antenna?
I'm a complete noob, that's why I'm asking you :P
If I understand correctly, you wish to receive digital radio on your Pi, which is different from what I have done. A quick googling around for "raspberry pi dab dongle" shows quite some results, so it should be possible. However I can't tell you which hardware is good, or how easy it would be to run it on the Pi. At first glance, it does not look like a plug-and-play type of thing, though.
Delete