Yesterday, I wrote about Controlling the RDA5807SP FM Radio Receiver with the Raspberry Pi. Today, I've managed to add a SoundBlaster USB sound card (model SB1290) to the mix and get the whole thing to generate a MP3 stream (via Darkice) to an Icecast2 server, elsewhere in my network. Following are notes on the steps that I took.
1) First, use Steffen Müller's procedure for compiling Darkice with mp3 support. Because I'm using an external sound card as a source, I had to tweak the darkice.cfg file just a bit. The file ended up looking like:
[general] duration = 0 # duration of encoding, in seconds. 0 means forever bufferSecs = 5 # size of internal slip buffer, in seconds reconnect = yes # reconnect to the server(s) if disconnected [input] device = default:Pro sampleRate = 11025 # sample rate in Hz. try 11025, 22050 or 44100 bitsPerSample = 16 # bits per sample. try 16 channel = 1 # channels. 1 = mono, 2 = stereo [icecast2-0] bitrateMode = vbr format = mp3 quality = 0.6 server = jukebox.joat port = 8000 # port of the IceCast2 server, usually 8000 password = donthackme # source password to the IceCast2 server mountPoint = radio name = DarkIce trial description = This is only a trial url = http://jukebox.joat genre = my own # genre of the stream public = yes # advertise this stream? #localDumpFile = recording.mp3
In the above, only the 16 bitsPerSample setting worked well. Setting it to 8 caused the audio to be accepted at a much, much lower volume. Also, uncomment the last line only if you want the Raspberry Pi to record to a local file, as well as sending the stream to Icecast (e.g., for troubleshooting). It eats up file space quickly.
Also in the above, I figured out which device to use by running "aplay -l" and "aplay -L". The latter showed two default sound cards (default:CARD=ALSA and default:CARD=Pro). The setting that worked for me is shown (default:Pro) (note: capitalization counts for this).
I next had to make sure that the appropriate kernel modules were loaded via:
modprobe snd-seq-oss modprobe snd-pcm-oss modprobe snd-mixer-oss
Update: I've been reminded that the above kernel modules should be loaded before attempting to list cards via the aplay commend (also above).
After all that, fire up Icecast2, the radio command, and Darkice (in that order). If Icecast is configured to accept the stream (mine is configured to accept any source which uses the proper password), you should see the new stream on the admin web page and should be able to listen to the steam by pointing a MP3 client at it.
Let me know if you try it?