ALSA and Debian Squeeze 19-04-2012

14 posts
by welsberr2 » Sat Jun 16, 2012 5:02 pm
I'm using the Debian Squeeze distribution (19-04-2012) and trying to get ALSA working with USB audio (Behringer Ucontrol UCA202).

In troubleshooting, I ended up running a script aimed at collecting ALSA information, and found that there is a mismatch in the driver versus library and utilities.

Driver version: 1.0.24
Library version: 1.0.23
Utilities version: 1.0.23

Mismatches like this are credited with many ALSA headaches elsewhere. Did I simply mess up my use of apt-get, or are others seeing the same thing?

Given the developmental status of ALSA on Debian Squeeze for RasPi, I wasn't sure whether I should just download ALSA 1.0.25 and try compiling it. Does anyone have more insight into what is up with ALSA for Debian Squeeze, and whether I should switch to a different OS distribution for my sound recording needs?
Posts: 6
Joined: Fri Jun 15, 2012 11:29 am
by calculon » Tue Jun 26, 2012 9:20 am
I can't be of any help as I'm a Linux newbie, but this is exactly the same application that I want to run on my Pi when it arrives. I'd be really grateful if you could report any success.
Posts: 18
Joined: Tue Jun 26, 2012 9:07 am
by calculon » Tue Jun 26, 2012 10:14 am
I've done a little research and found a couple of posts on Linux forums - here

which suggest going to /etc/modprobe.d/alsa-base.conf and changing the value of 'options snd-usb-audio index=-2' from -2 to 1 or 0.
As a Linux newbie of course this means nothing to me! But maybe it'll sort your problem out (which I hope will then eventually help me.)
Good luck!
Posts: 18
Joined: Tue Jun 26, 2012 9:07 am
by welsberr2 » Mon Jul 02, 2012 11:48 am
Thanks for the reply, calculon.

I did try changing the value indicated, but my issue still manifests.

If I find something that works, I'll post back.
Posts: 6
Joined: Fri Jun 15, 2012 11:29 am
by welsberr2 » Wed Jul 25, 2012 4:18 am
I've moved on to the official Raspbian release.

I've also tested a total of five different sound devices with Raspbian and ALSA for recording a mono microphone input. I've gotten one recording by fluke on a "Virtual 7.1 Ch Sound" device, and consistently get the claim that there is no capture device associated with the Behringer UCA202. The only device that has worked consistently for recording is a Syba "USB Stereo Sound Adapter" CMedia CM119. I didn't pay more than $9 for any of the non-Behringer devices.

The CMedia is recognized, the controls come up appropriately in alsamixer, and arecord works without complaint on it. My only problem in simply going with this adapter is that I cannot reliably reboot my RasPi with it plugged into the USB hub. If it is plugged in on boot, the network interface throws "kevent 4" errors. If the network is not plugged in, but the CMedia device is, ALSA throws a lot of errors at boot. Given that I want to deploy my RasPi remotely for a couple of weeks at a time, this sort of behavior doesn't give me confidence. Things have improved since the earliest firmware I was using, but there seems to be a ways to go.

Syba SD-CM-UAUD USB Stereo Audio Adapter, C-Media Chipset, RoHS ($8.08 from Amazon) ... tringer-20

The currently non-recording adapters:

Virtual 5.1-surround USB 2.0 External Sound Card ($1.78 from Amazon)

7.1 Channel USB External Sound Card Audio Adapter ($2.38 from Amazon)

Behringer UCA202 ($29.99 from Amazon)

Intermittently working adapter (I can't say exactly how I managed to get one recording done with this):

Syba USB2.0 7.1CH Sound Adapter Add Stereo Output Mono Input Led ($3.28 from Amazon)
Posts: 6
Joined: Fri Jun 15, 2012 11:29 am
by observing » Wed Jul 25, 2012 11:57 am
welsberr2, what is the sound quality of the recordings made with the CMedia device? My experience with it has been that, while the system (either squeeze or wheezy) has been happy with it, the recordings have been very distorted. If you have had good results, I would be interested in how you configured alsa and in any other related changes to the base Raspbian distribution.

Note to calculon: Changing the value of 'options snd-usb-audio index=-2' from -2 to 0 tells alsa to make that device the default device. In the RPi, snd-bcm2835 is normally the default device.
Posts: 51
Joined: Mon Feb 27, 2012 12:18 pm
by welsberr2 » Wed Jul 25, 2012 12:43 pm
My initial tests do have some breath noise from my being too close to the microphone, but I haven't encountered the distortion that others have mentioned. Nor were there obvious gaps or pops, as I've seen talked about. I'm checking with playback over the built-in sound port. All in all, I'm pretty pleased with the output so far, and I have expectations of doing some signal processing on acoustic data later.

My RasPi is set to allocate 224MB of RAM to the CPU. I am not running X, since my use would not require it.

I made two modifications to /etc/modprobe.d/alsa-base.conf.

options snd-usb-audio index=1
options snd-hda-intel model=generic

The CMedia works with these changes, but I'm not certain that it requires them.
Posts: 6
Joined: Fri Jun 15, 2012 11:29 am
by observing » Thu Jul 26, 2012 12:33 am
I just tried under Raspian and things are considerably improved. Part of the problem was that I was recording at an 8Kb/s rate (the default) and should have been using something faster. The installed samples, such as Front_Center.wav, sound great, but I still get some clicks and pops from recordings. I'm going to try other rates and play with the agc control in alsamixer to see if I can get better results.

By the way, the only thing I did was to change /etc/modprobe.d/alsa-base.conf to make the USB audio adapter the default device (options snd-usb-audio index=0).
Posts: 51
Joined: Mon Feb 27, 2012 12:18 pm
by welsberr2 » Fri Jul 27, 2012 1:11 pm
Sorry, I should have mentioned turning off AGC in alsamixer. For acoustics, you never use that stuff, so it's more of a reflexive action on my part. I don't know whether that would contribute to fewer pops and clicks, since I generally don't even bother with having it on.
Posts: 6
Joined: Fri Jun 15, 2012 11:29 am
by Light » Tue Dec 04, 2012 8:14 pm
Sorry to resurrect an old thread, but I'm having some trouble with my mic recording using the previously mentioned Syba SD-CM-UAUD USB Stereo Audio Adapter, C-Media Chipset, RoHS. Since there's some success here with this device, hopefully someone can help figure out what I've done wrong.

I've edited alsa-base.conf to make the Syba the default device. Confirmed after reload via cat /proc/asound/cards. In alsamixer, under capture, increased volume to max. Syba is connected via powered USB hub, nothing is plugged into the headphone jack, just the mic. A green light is visible near the mic plug.

When I run arecord -V mono /dev/null, the volume meter doesn't react when I speak into the mic. I just hovers at 0. pocketsphinx_continuous (I'm trying to do some speech recognition) fails to complete voice activity calibration. I was able to hear speech from the device in Win7 on a desktop, so I think I have merely failed to configure the Pi properly. It's running a fairly new Raspbian (I think I updated it 12/01 or 12/02).

Any ideas?
Posts: 6
Joined: Tue Dec 04, 2012 7:19 pm
by Light » Mon Dec 10, 2012 12:04 am
Update: I had failed to notice that the MM under the volume meter meant mute. Yea, kinda embarrassing... Also, it seemed to help to use plughw:0,0 rather than hw:0,0 with arecord and pocketsphinx. However, I still haven't gotten pocketsphinx_continuous to recognize speech yet.
Posts: 6
Joined: Tue Dec 04, 2012 7:19 pm
by ITPhoenix » Fri Dec 28, 2012 3:03 am
The proper way to test mic input to pocketsphinx is
Code: Select all
arecord -f S16_LE -r 16000 -D default > record.wav

Other than that I would have to say that everything involved with that program has to be 100% or it will not work. Here are some notes I keep for successful installs:


m4 (should be included with one of the above)

Move folders to /usr/local and make-install there, but do the following first:

export LD_LIBRARY_PATH=/usr/local/lib

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Take ownership or whatever you have to do to execute...

Sphinxbase must be installed first!

sh ./configure (or just ./configure, if it works)
make check
make install

This program has amazing accuracy and speed out of the box with no training if everything went well with the install, and of course, ALSA. It comes with a Wall Street Journal language model so if you speak some phrases that are usually encountered in that newspaper like, "the US Supreme Court,.....right wing conservatives, congressional session,.......etc. It should return 0 WER.
Posts: 2
Joined: Fri Dec 28, 2012 2:47 am
by ITPhoenix » Fri Dec 28, 2012 5:38 am
Almost forgot. The start command under Debian is:
Code: Select all
aoss pocketsphinx_continuous

You must build with libasound2 already installed for pocketsphinx to have ALSA support. The makefile will find it automatically.
Posts: 2
Joined: Fri Dec 28, 2012 2:47 am
by Light » Sat Dec 29, 2012 4:27 pm
Thanks, I was able to get pocketsphinx working as well. I think the key for me was passing -adcdev plughw:0,0 or something like that.
Posts: 6
Joined: Tue Dec 04, 2012 7:19 pm