4

I am attaching a mic to my Raspberry Pi 2 Model B (Jessie) and using it for my PocketSphinx implementation.

I see this in the system:

$cat /proc/asound/cards                                                                                                                            
0 [ALSA           ]: bcm2835 - bcm2835 ALSA                                                                                                                   
                     bcm2835 ALSA                                                                                                                             
1 [Mic            ]: USB-Audio - Samson Meteor Mic                                                                                                            
                     Samson Technologies Samson Meteor Mic at usb-3f980000.usb-1.2, full speed  

According to PocketSphinx documentation, I need to move the mic to index 0. In Wheezy, you alter the file located at /etc/modprobe.d/alsa-base.conf with the following:

options snd-usb-audio index=0

However, in Jessie, the ALSA configuration system has changed. There is no alsa-base.conf anymore and it is replaced by /usr/share/alsa/alsa.conf.

The format in the new conf file doesn't seem to be compatible with the old format.

Help!

colinwong
  • 171
  • 6

1 Answers1

3

I found a workaround. Instead of re-ordering the index for the mic card, I can change the default mic card with this:

$sudo vi ~/.asoundrc

pcm.usb
{
    type hw
    card Mic
}

pcm.internal
{
    type hw
    card ALSA
}

pcm.!default
{
    type asym
    playback.pcm
    {
        type plug
        slave.pcm "internal"
    }
    capture.pcm
    {
        type plug
        slave.pcm "usb"
    }
}

ctl.!default
{
    type asym
    playback.pcm
    {
        type plug
        slave.pcm "internal"
    }
    capture.pcm
    {
        type plug
        slave.pcm "usb"
    }
}

Make sure to change "Mic" to whatever card name is recognized by your system by doing "cat /proc/asound/cards".

colinwong
  • 171
  • 6
  • I got the following error: ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_ctl_asym.so – Rafi Aug 15 '16 at 15:34