Pi: USB sound card nightmare

Original post from January 2015

As a follow on to the previous post about the raspberry Pi

I bought two USB sound cards from Matrix Warehouse. They were these two C-Media based chipsets:

7.1: http://www.amazon.com/Channel-External-Sound-Audio-Adapter/dp/B007HISGRW/ref=sr_1_3?ie=UTF8&qid=1382967519&sr=8-3&keywords=usb+sound+card
5.1: http://www.amazon.com/Virtual-5-1-surround-External-Sound-Card/dp/B000N35A0Y/ref=pd_bxgy_pc_img_y

The 7.1 was only giving static. It turns out that the mic I was using was broken, but I learned quite abit about Linux sound tool sets.

These posts were very helpfull:
http://computers.tutsplus.com/articles/using-a-usb-audio-device-with-a-raspberry-pi--mac-55876
http://www.raspberrypi.org/forums/viewtopic.php?p=314611#p314611
http://www.linuxcircle.com/2013/05/08/raspberry-pi-microphone-setup-with-usb-sound-card/

the 7.1

dmesg:
    3.303196] usb 1-1.5: new full-speed USB device number 4 using dwc_otg
[    3.434770] usb 1-1.5: New USB device found, idVendor=0d8c, idProduct=013c
[    3.449598] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    3.473047] usb 1-1.5: Product: USB PnP Sound Device
[    3.479635] usb 1-1.5: Manufacturer: C-Media Electronics Inc.      
[    3.513315] input: C-Media Electronics Inc.       USB PnP Sound Device as /devices/platform/bcm2708_usb/usb1/1-1/1-1.5/1-1.5:1.3/input/input0
[    3.551191] hid-generic 0003:0D8C:013C.0001: input,hidraw0: USB HID v1.00 Device [C-Media Electronics Inc.       USB PnP Sound Device] on usb-bcm2708_usb-1.5/input3
[    3.997860] udevd[156]: starting version 175
[    6.413474] bcm2708-i2s bcm2708-i2s.0: Failed to create debugfs directory

[    6.848620] usbcore: registered new interface driver snd-usb-audio

[email protected] ~/recordings $ cat /proc/asound/cards 
 0 [Device         ]: USB-Audio - USB PnP Sound Device
                      C-Media Electronics Inc. USB PnP Sound Device at usb-bcm2708_usb-1.5, full spee
 1 [ALSA           ]: bcm2835 - bcm2835 ALSA
                      bcm2835 ALSA
[email protected] ~/recordings $ lsusb 
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller

[email protected] ~/recordings $ amixer 
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch pswitch-joined penum
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 151
  Mono:
  Front Left: Playback 136 [90%] [-2.88dB] [on]
  Front Right: Playback 136 [90%] [-2.88dB] [on]
Simple mixer control 'Mic',0
  Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined penum
  Playback channels: Mono
  Capture channels: Mono
  Limits: Playback 0 - 127 Capture 0 - 16
  Mono: Playback 98 [77%] [18.37dB] [off] Capture 14 [88%] [20.83dB] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [on]

[email protected] ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

[email protected] ~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

[email protected] ~/pi_scripts $ arecord -f S16_LE -c1 -r44100 -t wav test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
^CAborted by signal Interrupt...
[email protected] ~/pi_scripts $ aplay test.wav 
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono


[email protected] ~/recordings $ arecord -D plughw:0 -r 48000 test.wav
Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 48000 Hz, Mono
^CAborted by signal Interrupt...
[email protected] ~/recordings $ arecord -D plughw:0 -r 16000 test.wav
Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 16000 Hz, Mono
^CAborted by signal Interrupt...
[email protected] ~/recordings $ arecord -f S16_LE -D plughw:0,0 -r 48000 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
^CAborted by signal Interrupt...
[email protected] ~/recordings $ 


[email protected] ~/recordings $ cat /boot/cmdline.txt p. 
dwc_otg.lpm_enable=0 dwc_otg.speed=1 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
[email protected] ~/recordings $