pete_l
Posts: 18
Joined: Thu May 17, 2012 7:08 am

Adding a microphone - question

Wed Jul 24, 2013 6:55 pm

Since the Pi doesn't support microphone input, I've attempted to add a small USB sound card to fix this problem.
The card is seen by my
Linux pi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l GNU/Linux
kernel and dmesg reports it as this:
[19591.036582] hid-generic 0003:04D9:1503.000D: input,hidraw2: USB HID v1.10 Device [ USB Keyboard] on usb-bcm2708_usb-1.3.4/input1
[19591.967838] usb 1-1.3.1: new full-speed USB device number 14 using dwc_otg
[19592.078669] usb 1-1.3.1: New USB device found, idVendor=1130, idProduct=f211
[19592.078700] usb 1-1.3.1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[19592.078717] usb 1-1.3.1: Product: USB AUDIO
[19592.091217] usbmixer: volume control quirk for Tenx TP6911 Audio Headset
[19592.091277] usbmixer: volume control quirk for Tenx TP6911 Audio Headset
[19592.099032] input: USB AUDIO as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.3/input/input13
[19592.102416] hid-generic 0003:1130:F211.000E: input,hidraw3: USB HID v1.10 Device [USB AUDIO ] on usb-bcm2708_usb-1.3.1/input3
[19592.106879] input: USB AUDIO as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.4/input/input14
[19592.108899] hid-generic 0003:1130:F211.000F: input,hidraw4: USB HID v1.10 Device [USB AUDIO ] on usb-bcm2708_usb-1.3.1/input4


When I look in /dev/snd I have the following entries:
Pi-root: ls -l /dev/snd
total 0
drwxr-xr-x 2 root root 60 Jul 24 15:46 by-id
drwxr-xr-x 2 root root 80 Jul 24 15:46 by-path
crw-rw---T+ 1 root audio 116, 0 Jul 24 10:17 controlC0
crw-rw---T 1 root audio 116, 32 Jul 24 15:46 controlC1
crw-rw---T+ 1 root audio 116, 16 Jul 24 15:55 pcmC0D0p
crw-rw---T 1 root audio 116, 56 Jul 24 15:46 pcmC1D0c
crw-rw---T 1 root audio 116, 48 Jul 24 15:46 pcmC1D0p
crw-rw---T+ 1 root audio 116, 1 Jul 24 10:17 seq
crw-rw---T+ 1 root audio 116, 33 Jul 24 10:17 timer


aplay -l tells me this:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 7/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: AUDIO [USB AUDIO], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0


and I get the following PCMs reported:
Pi-root: aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
default:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
sysdefault:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
default:CARD=AUDIO
USB AUDIO, USB Audio
Default Audio Device
sysdefault:CARD=AUDIO
USB AUDIO, USB Audio
Default Audio Device
front:CARD=AUDIO,DEV=0
USB AUDIO, USB Audio
Front speakers
surround40:CARD=AUDIO,DEV=0
USB AUDIO, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=AUDIO,DEV=0
USB AUDIO, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=AUDIO,DEV=0
USB AUDIO, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=AUDIO,DEV=0
USB AUDIO, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=AUDIO,DEV=0
USB AUDIO, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=AUDIO,DEV=0
USB AUDIO, USB Audio
IEC958 (S/PDIF) Digital Audio Output


The question is: what do I tell sox to use as the input device?

drgeoff
Posts: 12420
Joined: Wed Jan 25, 2012 6:39 pm

Re: Adding a microphone - question

Wed Jul 24, 2013 10:36 pm

This is pure speculation on my part. :)

If:
"aplay -l tells me this:
aplay -l
**** List of PLAYBACK Hardware Devices ****"

would 'arecord -l' and 'arecord -L' give info on input/recording devices?
Quis custodiet ipsos custodes?

Chiara
Posts: 10
Joined: Tue Aug 20, 2013 7:44 am

Re: Adding a microphone - question

Tue Aug 20, 2013 7:49 am

alsactl init

Code: Select all

Found hardware: "BRCM bcm2835 AL" "Broadcom Mixer" "" "" ""
Hardware is initialized using a generic method

lsusb |grep -i audio

Code: Select all

Bus 001 Device 004: ID 1130:f211 Tenx Technology, Inc. TP6911 Audio Headset
aplay -l

Code: Select all

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/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: AUDIO [USB  AUDIO], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
aplay -L

Code: Select all

null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
sysdefault:CARD=AUDIO
    USB  AUDIO, USB Audio
    Default Audio Device
front:CARD=AUDIO,DEV=0
    USB  AUDIO, USB Audio
    Front speakers
surround40:CARD=AUDIO,DEV=0
    USB  AUDIO, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=AUDIO,DEV=0
    USB  AUDIO, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=AUDIO,DEV=0
    USB  AUDIO, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=AUDIO,DEV=0
    USB  AUDIO, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=AUDIO,DEV=0
    USB  AUDIO, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=AUDIO,DEV=0
    USB  AUDIO, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
and alsamixer show:

Code: Select all

│                                                                                                     │
│                                                                                                     │
│                                            ┌──┐                                               │
│                                            │OO│                                               │
│                                            └──┘        L    R                               │
│                                                          CAPTURE                          │
│                                         <  PCM   >     Mic                                │
│                                                                                                     │
without control volume bar.
Why this happen, what am I missing?

mnoit
Posts: 8
Joined: Sat Aug 24, 2013 10:18 am
Location: Lille France

Re: Adding a microphone - question

Sat Aug 24, 2013 1:02 pm

The question is: what do I tell sox to use as the input device?
sox works with files.

Code: Select all

arecord -d 10 -f cd -t wav -D hw:1 foobar.wav
will get you 10 seconds of cd-quality audio. hw:1 is your usb sound card.
If you want to apply some filters in realtime, I suggest you take a look at Jack and/or LADSPA/LV2.

mnoit
Posts: 8
Joined: Sat Aug 24, 2013 10:18 am
Location: Lille France

Re: Adding a microphone - question

Sat Aug 24, 2013 1:20 pm

Chiara wrote: without control volume bar.
Why this happen, what am I missing?
Well, what you are missing is a question:)
There is no control bar because there is no volume control. This is perfectly normal:UAC (USB Audio Class) does not define a way to implement a hardware control. Some high-end cards have specific extensions, or non-standard drivers, to get some.
You can adjust PCM output in the software you use, or setup an alsa plugin: put this in /home/pi/.asoundrc

Code: Select all

pcm.softvolusbsouncard {
    type            softvol
    slave {
        pcm         "hw:1"
    }
    control {
        name        "PCM"
        card        1
    }
}
You can now use it with eg aplay:

Code: Select all

aplay -D softvolusbsouncard foobar.wav

Return to “Advanced users”