By the Fading Light
of an evanescing moon

By the Fading Light

Logitech USB Desktop Microphone in Linux

May 6th, 2006

So you decided to go with the logitech usb mic, and now it’s being a pain in linux. Sure, you plugged it in and it was recognized, things aren’t as bad as they used to be for us, but half of your apps aren’t using it!

First off, this guide only fixes the problem for an application that uses ALSA. OSS has its problems, and I would rather leave them behind when possible. If you are using OSS, the mic shows up as the next available /dev/dsp device, and your application may let you specificy a device for input and output seperately. With Gizmo this is done using the -x -m and -s arguments.


-x, --mixer[=/dev/?] Set the mixer audio device
-m, --mic[=/dev/?] Set the mic audio device
-s, --speaker[=/dev/?] Set the speaker audio device

If you are using Skype, their Linux Sound FAQ - ALSA may be of some help. It seems more picky about things from what i’ve seen, although I haven’t actually used it. Their forums state that ALSA support is being developed, though I didn’t noticed any progress since October.

Now, I opted to use ALSA, and things don’t seem to be quite as easy as passing a device parameter. I first tried specifying hw:1,0 as the device, but it didn’t help. A lot of snooping around to figure out how to “link” devices in my asoundrc file (which i’ve played with before, trying to get spdif out working when I first upgraded from OSS on slackware) and I’ve found this:


pcm.!default {
type plug
slave.pcm "combined"
}

pcm.combined {
type asym
playback.pcm "playback"
capture.pcm "hw:1,0"
}

pcm.playback {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
bindings {
0 0
1 1
}
}

ctl.dmixer {
type hw
card 0
}

Put that into your ~/.asoundrc file and any applications using ALSA should pick up your mic as the default capture device, while still using your first card for playback. This of course requires that your system has two “cards”, with the microphone being second. If you have a different setup, change the device numbers.
cat /proc/asound/devices
This will list your options. The mic will only have entries for audio capture and ctl.

Now that it is working, you will most likely also want to record audio files. Podcasting has become popular, and I’ve seen Audacity reccommended multiple times. I’ve used it on numerous occasions for odd jobs, however the current situation is less than ideal. Audacity doesn’t natively support ALSA, and doesn’t let me change the default dsp device. Even if it did, I would have to choose - recording, or playback. Not both.
Things are looking forward though, it is being developed and if you need it right now just compile with
./configure --with-portaudio=v19 --without-portmixer

More information at their wiki

Since I was forced to use something new to record, I ended up finding mhWaveEdit. I am impressed with it, and love the pause recording button. I did use Audacity to edit the wave and export as ogg and mp3, however you may want to check out Rosegarden if you also do MIDI, as it is possible to record audio. I had no luck with krec and krecord, they seem to be stuck on OSS, however that may be my distribution. Kwave looked interesting, but I Haven’t had a chance to use it so far, as it was giving me buffer errors. It does see the device though!

Lastly, if you want to play with your asoundrc some more, check out the alsa documentation. There is plenty to read, And this is a good place to start. If you need oss the page mentions this method combined with aoss. I hope you’ve found this useful, and if you have anything to add feel free to email me or leave a comment.