Streaming Audio with Ices and Icecast
Once I had everything set up and running, I spent a fair amount of time fine-tuning the audio. The first thing I found was that the audio level was quite low. Normally, when I want to turn up the audio level, I use KMix. But, I hadn't installed a window manager on my encoding computer. My system uses ALSA as the sound system, and I found out that there is a great curses-based mixer for ALSA named Alsamixer. It allows you to use the arrow keys to change settings. Figure 4 shows the settings I chose for my card. My final preference was to have the Master and PCM both at 100%. I also chose to mute everything else, because I knew they would not be in use.
Now that the audio was loud enough, I still had another problem. The audio sounded choppy. After looking around for a while, I realized that the processor usage was at 100%. I tried to reduce the bitrate by changing the value of the nominal-bitrate setting. With the bitrate set sufficiently low, the audio sounded good. I guess you can't encode very high-quality audio with a 233MHz processor.
When the audio sounded good, my goal was to lower the bitrate as much as possible while keeping an acceptable level of audio quality. In my case, an “acceptable level” is quite low. The traffic on the W0ZWY repeater is only voice, because it is illegal to transmit music in the amateur radio bands.
Three aspects of the encoded audio will affect its quality and bitrate: number of channels, sample rate and bitrate. I started by setting the downmix to 1, because the scanner is only mono. Then, I incrementally decreased the sample rate until I found the lowest setting that rendered acceptable audio; 11127Hz ended up being the minimum. Instead of setting the bitrate with the nominal-bitrate setting, I used the quality setting. The quality setting directly affects the final bitrate. With a few tries, I chose a quality level of 2.
With my final settings, the bitrate stays around 30Kbps, and the processor hovers around 40% usage.
There are probably many other applications where this type of system would be useful. Keep in mind, however, if you are interested in using this type of system for streaming music, make sure you have permission from the artists and recording studios.
This combination of open-source projects really worked well together. Setting up everything was quite simple. I spent most of my time tweaking the quality and sample rate settings. The traffic on my streamer is quite low. I usually have only one or two connections per week. But, it was fun to learn, and it is my little way of participating in the amateur radio community.
Ices Settings and Bitrates
The quality, sample rate and channels settings all will affect the bitrate of the stream. Table 1 shows various combinations of these settings and their resulting bitrates.
Brian Matherly is a Software Engineer at Sencore Electronics in Sioux Falls, South Dakota. He is also an adjunct professor at Colorado Technical University.
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal