14

I am facing a similar problem as described in this question. However I am running Jessie on Raspberry Pi and that it does not have a /etc/modprobe.d/alsa-base.conf file.

So can someone tell me where and how to set the default input and output audio device on Jessie.

Parth Doshi
  • 253
  • 1
  • 3
  • 8

3 Answers3

12

Ok, first delete the file /etc/modprobe.d/alsa-base.conf Raspbian Jessie does not use this config file like Wheezy did.

To find what address your device uses you need to first enter the command aplay -l this shows all audio output devices, and their address. For example, my USB sound card comes up as device 1 in the output which looks like this.

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 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Now, to set the device to your default card you will need to edit the file /usr/share/alsa/alsa.conf with the command sudo nano /usr/share/alsa/alsa.conf scroll down until you find the lines

defaults.ctl.card 0
defaults.pcm.card 0

and change them to (if your device is also listed as device 1, if not change the 1 to whatever address it was listed at)

defaults.ctl.card 1
defaults.pcm.card 1

Explanation: USB sound cards are registered as card 1 on Raspbian Jessie. On Wheezy they would be registered as card -2 by default and editing /etc/modprobe.d/alsa-base.conf would change that.

I do not know if this next step is necessary but without it my card wouldn't work.

Create and edit the file ~/.asoundrc by using the command sudo nano ~/.asoundrc and change it so that it only reads this:

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

Now your default audio out (speakers) and audio in (mic) are your usb device.

Patrick Cook
  • 6,365
  • 8
  • 38
  • 63
5

Question is referring to another post which has already an answer that simply states that with Jessie there is no need to edit /usr/share/alsa/alsa.conf, just create ~/.asoundrc and type in

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

PS: I just tested it with a clean installation on a raspberry 2 connected with Logitech Z-5 speakers, works perfectly

Edoardo
  • 158
  • 1
  • 5
4

If you have a different device for input and output (e.g. usb mikrophone and 3.5mm audio speaker), you can write it like this in your ~/.asoundrc:

pcm.!default {
  type asym
  playback.pcm
  {
    type hw
    card 0
    device 0
  }
  capture.pcm
  {
    type hw
    card 1
    device 0
  }
}
CodingVoid
  • 41
  • 1