linux - How to configure different ALSA defaults for capture through one device and playback through another? -


i'm looking in configuring audio on raspberry pi googling efforts have fallen short far!

my setup:

  • raspberry pi 3 (running debian jessie)
  • usb webcam (logitech) i'm using capture audio
  • external speaker in 3.5mm audio jack used playback

so far i've managed configure alsa to, default, capture via usb webcam , playback via 3.5mm jack. example, following works fine:

# capture webcam arecord test.wav  # playback through 3.5mm jack aplay test.wav 

by default captures audio in 8-bit, 8khz, mono. however, i'd default capture process use 16-bit, 16khz, mono settings, , i'm stuck.

here's working ~/.asoundrc file:

pcm.!default {          type asym          playback.pcm {                 type hw                 card 1                 device 0         }          capture.pcm {                 type plug                 slave {                         pcm {                                 type hw                                 card 0                                 device 0                         }                 }         } } 

and /etc/modprobe.d/alsa-base.conf:

options snd_usb_audio index=0 options snd_bcm2835 index=1  options snd slots=snd-usb-audio,snd-bcm2835 

and output of cat /etc/asound/cards:

 0 [u0x46d0x825    ]: usb-audio - usb device 0x46d:0x825                       usb device 0x46d:0x825 @ usb-3f980000.usb-1.4, high speed  1 [alsa           ]: bcm2835 - bcm2835 alsa                       bcm2835 alsa 

i've followed various guides set format, rate , channels attributes without success. example, didn't work:

pcm.!default {          type asym          playback.pcm {                 type hw                 card 1                 device 0         }          capture.pcm {                 type plug                 slave {                         pcm {                                 type hw                                 card 0                                 device 0                         }                         format s16_le                         rate 16000                         channels 1                 }         } } 

(i've tried moving attribute inside pcm block in 1 of many desperate attempts!)

in truth have no experience audio on linux @ all, , utterly lost , guidance hugely appreciated!

aplay uses whatever sample format file has, arecord creates new file, have specify sample format if not want silly defaults:

arecord -f s16_le -r 16000 -c 1 test.wav 

Comments