Search code examples
node.jsraspberry-pimicrophoneraspbianalsa

Set one device for output and another one for input in Raspberry Pi


I added an USB Microphone to my Raspberry Pi, but now I cannot play sounds thru Nodes.js, me:

[../deps/mpg123/src/output/alsa.c:165] error: cannot open device default

I guess it's because it's trying to play the sound thru the USB Microphone, because I set: options snd-usb-audio index=0 in order to user the Microphone.

So, my question is: Is there any way to tell ALSA which device it should use for output and which device it should use for input. I'm trying to use the USB for input and the 3.5mm jack for output.

Thank you in advance.


Solution

  • The Speaker module does not allow to configure its output device.

    You could set the internal device as the default device, and configure your recording applications to use the USB microphone.

    Alternatively, try a definition like the following in /etc/asound.conf:

    pcm.default {
        type asym
        playback.pcm "plughw:1"   # or dmix for software mixing
        capture.pcm  "plughw:0"
    }