3

I was trying to prepare my RPi for jasper and plugged the USB mic and the speakers in the 3.5 jack. Trying to configure it I found out that I could only chose that the whole audio IO is going through USB with 1 or through the 3.5 jack with 0 when configuring the alsa.conf file. Is there a way to make my setup work? I think it was possible in Raspbian Wheezy, because they said in their documentation that you need some speaker which work with the headphone jack of the Pi.

EDIT

arecord -l :

**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

aplay -l:

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/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 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

So I got that my card 1 is the one with the mic and card 0 is with the aux output and HDMI output. According to the jasper documentation I have set my alsa.conf like this:

...
# show all name hints also for definitions without hint {} section
defaults.namehint.showall on
# show just basic name hints
defaults.namehint.basic on
# show extended name hints
defaults.namehint.extended on
#
defaults.ctl.card 1 #<- changed from 0 to 1
defaults.pcm.card 1 #<- changed from 0 to 1
defaults.pcm.device 0
...

And I made a .asoundrc file in the root directory with these options:

pcm.!default {
        type hw
        card 1
}
ctl.!default {
        type hw
        card 1
}

If I leave the alsa.conf on 0, I am able to play something with aplay, but putting it on 1 doesn't allow me to play it (of course, because on card 1 is the mic). Also calling alsamixer gives me only the bcm2835 card, which is my output card if I am not mistaken.

4
  • Are you using PulseAudio, or do your programs access ALSA directly?
    – CL.
    Commented Mar 9, 2017 at 9:04
  • I was doing it with the alsa.conf file. And also with .asoundrc file in /root
    – arunoruto
    Commented Mar 9, 2017 at 10:11
  • What did you try in those files?
    – CL.
    Commented Mar 9, 2017 at 11:41
  • I have updated my post.
    – arunoruto
    Commented Mar 9, 2017 at 12:47

1 Answer 1

9

To get different definitions for playback and capture, use the asym device:

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

(Something like this is not possible for control devices.)

8
  • I will try that as soon as I can. Do I have to do that also on the ctl part too? I am asking because I don't know what pcm and ctl stands for. And what does control device mean?
    – arunoruto
    Commented Mar 9, 2017 at 13:35
  • ctl.xxx defines a control device.
    – CL.
    Commented Mar 9, 2017 at 13:42
  • Now I am really able to use both of them. So I am able to do aplay and arecord without changing anything in my conf files. What do you recomment to set the default ctl? On the card with the Audio Jack or on the USB card?
    – arunoruto
    Commented Mar 10, 2017 at 15:40
  • Well, which one do you want to see when you run alsamixer?
    – CL.
    Commented Mar 10, 2017 at 15:55
  • 1
    @NaderGhanbari These definitions specify what device actually gets accessed when an application opens the device named default.
    – CL.
    Commented Jun 1, 2019 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.