6

I'm trying to set up my RPi with on-board sound out and a USB mic in, but everything I've found only deals with both audio i/o on the same (external) sound card. What's happening in my situation is that regardless of the default sound card I set, either one of aplay or arecord will fail with an error message that looks like: arecord: main:682: audio open error: No such file or directory (replace arecord with aplay if the default card is set to usb mic).

I know you can add the device name when running the command (arecord -Dhw:1,0 test.wav works, but arecord test.wav doesn't), but I would like that to not happen because I'm using a bunch of pre-compiled libraries that seem to only consider the default devices

EDIT:

For example, I have the following scenario:

in /etc/modprobe.d/alsa-base.conf, commenting out options snd-usb-audio index=-2 will allow arecord to work, but not aplay, and uncommenting the above line will allow aplay to work, but not arecord

jaswon
  • 101
  • 1
  • 6

1 Answers1

4

adding an 'asymmetrical' ALSA device worked:

change the contents of /etc/asound.conf and ~/.asoundrc to the following:

pcm.!default {
    type asym
    playback.pcm "hw:0,0"
    capture.pcm "hw:1,1"
}

and sudo alsa force-reload for good measure

jaswon
  • 101
  • 1
  • 6
  • My journey started with ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave and after a few hours, I ended up here. Great fix, thx. – zipzit Dec 28 '16 at 21:48