[ Back to Kevin's Homepage ]

C-Media USB Sound dongle

The device

I purchased this usb sound dongle at Halted in Santa Clara. It is a tiny little dongle and has two 1/8" (3.5mm) jacks. One stereo headphone output and one microphone input.

The software support

Mac OS X 10.4.8 worked for both headphone out and microphone in without loading any extra software.

(Linux) Ubuntu "Dapper Drake" 6.06 LTS desktop (2.6.15-23-386) worked for both headphone out and microphone in without loading any extra software. (ALSA is default) (I tested on a stock CD install, without any software updates)

(Linux) Fedora Core 3 also worked for both headphone out and microphone in without loading any extra software. (ALSA is default) (with all software updates as of 2006.10.01.

Making noise on Linux

First, boot your computer. Then once it's booted, plug in the dongle. Here's the output I see from /var/log/messages when I plugged in the dongle:

$ tail -6 /var/log/messages
Oct  4 19:57:31 pocket kernel: usb 1-1: new full speed USB device using uhci_hcd and address 41
Oct  4 19:57:31 pocket kernel: input: USB HID v1.00 Device [C-Media USB Headphone Set  ] on usb-0000:00:1d.0-1
Oct  4 19:57:31 pocket hal.hotplug[9853]: DEVPATH is not set
Oct  4 19:57:32 pocket logger: usb.agent add USB product d8c/c/100
Oct  4 19:57:32 pocket last message repeated 3 times
Oct  4 19:57:43 pocket kernel: usbcore: registered new driver snd-usb-audio
$ lsusb
[... snip ...]
Bus 001 Device 041: ID 0d8c:000c C-Media Electronics, Inc.

Fedora Core 3 and Ubuntu run the ALSA sound system, so off to the ALSA tools to find the device:

$ aplay -l
[ ... snip ... ]
card 2: default [C-Media USB Headphone Set  ], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Note the values "Card 2" and "Device 0". we'll need those numbers later. They will vary depending on what kind of devices are installed in your system.

Verify that amixer works properly (should, considering aplay worked above)

$ amixer -c 2 
Simple mixer control 'Mic',0
  Capabilities: pvolume pvolume-joined cvolume pswitch pswitch-joined cswitch cswitch-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: Playback 0 - 255 Capture 0 - 127
  Mono: Playback 184 [72%] [off] Capture 0 [0%] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 151
  Front Left: Playback 151 [100%] [on]
  Front Right: Playback 151 [100%] [on]

Where did I come up wth the "-c 2"? That identifies that we want to probe "Card 2" as reported above. Now that it works, we should test it! Start by setting the volume low, play a music track, and then slowly adjust the volume upwards:

$ amixer -c 2 set Speaker 20%
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 151
  Front Left: Playback 30 [20%] [on]
  Front Right: Playback 30 [20%] [on]
$ mpg321 -a hw:2,0 /tmp/track*mp3 &
$ amixer -c 2 set Speaker 30%
$ amixer -c 2 set Speaker 40%
$ amixer -c 2 set Speaker 50%
$ amixer -c 2 set Speaker 60%
$ amixer -c 2 set Speaker 70%
$ amixer -c 2 set Speaker 80%
$ amixer -c 2 set Speaker 90%
$ amixer -c 2 set Speaker 100%
$ amixer -c 2 set Speaker 20%

The "hw:2,0" refers to "Card 2, Device 0" as reported above. The "&" after the mpg123 runs it in the background so that you can continue to use this shell for other things, like setting the volume controls. The LED on the usb dongle blinks while it's actively outputting music. Adjust it upward slowly until you get a usable volume out. If you don't get anything, remember to set it back to 20% and recheck your wiring.

If you don't have mpg321, you can use a raw sound file with aplay. Here are some locations of a sound that is in the various Linux distributions:

Fedora core:
$ aplay -D hw:2,0 /usr/share/system-config-soundcard/sound-sample.wav
Ubuntu:
$ aplay -D hw:2,0 /usr/share/sounds/login.wav

Again, "hw:2,0" refers to "Card 2, Device 0" as reported above. Note that this sound is very short; only 2 seconds long, so you may need to play it multiple times to make sure that your headphone out works.

Other: It doesn't seem to like playing a 22kHz stereo file. I haven't figured out that one yet, but my intent is to use this for music, and all of my music is sampled at 44.1kHz stereo, so I will not personally encounter that bug. It may be possible to use a daemon sound remixer (dmix?) to always force-resample anything to a fixed audio rate.

Recording noise on Linux

First, a little about the hardware: The one catch with this usb dongle is that you can't use a regular 1/8" (3.5mm) mono microphone plug; you have to have a stereo microphone plug. Just the plug; it's only a mono input on the usb dongle. This means that your microphone has to have three connectors on it, such that it looks like a regular stereo headphone connector. Some computer headsets are already wired like that, such as the Plantronics .Audio 310 Multimedia Headset . If you want to use your existing mono microphone, it's as simple as getting a mono-to-stereo adapter; mono (ground/tip 2 conductor) on the microphone side, stereo (ground/ring/tip 3 conductor) on the usb dongle side. It's ok to connect both ring and tip on the usb dongle side to the tip of the microphone. tip is not actually required, but for simplicity and reusability, you should. (Need a sketch? email me)

Using the same device settings above "hw:2,0", record a short sound snippet and play it back. In a pinch, you can use your headphones as a low quality microphone.

$ arecord -D hw:2,0 -d 10 -f cd -c 1 /tmp/noise
# "-d 10" = Record for 10 seconds, exits automatically
# "-f cd" = cd quality recording
# "-c 1" = mono recording

# playback through the default sound output
$ amixer set Speaker 50%   
$ aplay /tmp/noise

This sound dongle is also full duplex. I tested it by running arecord and aplay at the same time:

$ arecord -D hw:2,0 -d 10 - | aplay -D hw:2,0 -

Conclusion

This is a well supported usb sound dongle that seems to work without any fuss on a wide variety of platforms.


KJW - kjw@rightsock.com