I was looking for a cheap solution to stream audio. Cheap does not only mean the costs of the computer where the encoder is running, it also includes the costs to keep it running. With that I mean power consumption and maintenance time. And there is the Raspberry Pi as cheap and energy saving computer. There is only one problem: the Pi does only have audio out. Not audio in.

When you need cheap electronics, Deal Extreme comes into place. If you don’t know the webshop: it’s cheap-ass stuff from China and pricing includes free delivery. Yes, order a $2,09 USB audio card and shipping is free. But be warned. When browsing dx.com, you always order more stuff then you need. Delivery takes up about two weeks.

Shopping list:

First things fitst. It’s a known issue that the Raspberry Pi can create some noise with audio playback. To start off, I’d suggest to update to the latest firmware where this issue is resolved. Follow the steps below to install packages needed and upgrade the Raspberry Pi firmware. Don’t forget to reboot afterwards.

sudo apt-get -y install git-core
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
sudo chmod +x /usr/bin/rpi-update
sudo rpi-update
sudo reboot

Now we have to disable the internal audiocard so things get less complicated. First type aplay -l to find your audio device. You shout see something as “bcm2835 ALSA”. This is the onboard card (out) we want to disable. To do this, at the command line, enter “sudo vi /etc/modprobe.d/alsa-base.conf“. Look at the last line which reads “options snd-usb-audio index=-2”. You need to “comment this out” by inserting a “#” at the beginning of the line, which makes it a non-executing or information-only line. Exit vi by pressing [esc] and type :wq!. Now reboot your Raspberry Pi with sudo reboot.

Choose your favorite cup of cake to stream, either IceCast, ShoutCast or something else. Keep in mind that the Pi isn’t the fastest computer so try encoding with low bit rates like 11 or 22 kHz sampling rate to test.

Raspberry Pi with cooling fan and USB audio in

Raspberry Pi with cooling sink and USB audio in