Banacek
Posts: 3
Joined: Sun Dec 08, 2013 8:38 pm

Downmix to mono question

Sun Dec 08, 2013 8:44 pm

I'm using my Raspberry Pi to provide music to my whole home audio, so I don't need any stereo output (and don't want just a single channel). So I found instructions on how to downmix to mono here:

http://superuser.com/questions/155522/f ... o-on-linux

My question is how to I determine if my output is 'hw:0'? I'm using a USB audio device for output. Thanks!

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: Downmix to mono question

Sun Dec 08, 2013 10:50 pm

You can list all the sound devices on your system with the command:

Code: Select all

aplay -l
(I'm pretty sure aplay comes with Rasbpian, if not install the alsa-utils package)

You'll get a few lines like:

Code: Select all

card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
In this example, this is device 7 on card 0, which would translate to "hw:0,7". Your USB card will likely be "hw:1,0".

Banacek
Posts: 3
Joined: Sun Dec 08, 2013 8:38 pm

Re: Downmix to mono question

Sun Dec 08, 2013 11:06 pm

Code: Select all

pi@raspberrypi ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: 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
So for me I would use 'hw:0,0' for card 0, device 0?

Thanks

User avatar
aTao
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Downmix to mono question

Sun Dec 08, 2013 11:12 pm

Well, thats one way to do it...

However, since there are 270 ohm resistors in the audio output stage then a simple "join the wires together" mixer will do the job.
>)))'><'(((<

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: Downmix to mono question

Mon Dec 09, 2013 4:43 am

Banacek wrote:

Code: Select all

pi@raspberrypi ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: 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
So for me I would use 'hw:0,0' for card 0, device 0?

Thanks
Correct. However, please note that the card names are assigned on boot, so if you boot your Pi with the USB sound card unplugged then the internal sound card will be assigned the ID 'hw:0,0', and the USB card will be assigned the name 'hw1,0' when it is plugged in.

You can fix this by using ALSA's slot feature, which reserves names for different sound card drivers. Edit the file /etc/modprobe.d/alsa-base.conf (the name might be a bit different, I'm on Linux Mint on my laptop right now) and add this line to the bottom:

Code: Select all

options snd slots=snd-usb-audio
After rebooting, slot 0 will be reserved for USB audio devices so your card will always be "hw:0,0". If you'd like to put it in slot 1 instead ("hw:1,0") use:

Code: Select all

options snd slots=,snd-usb-audio
The comma before snd-usb-audio tells ALSA to reserve slot 1 instead of 0.

Banacek
Posts: 3
Joined: Sun Dec 08, 2013 8:38 pm

Re: Downmix to mono question

Mon Dec 09, 2013 6:58 pm

Sweet. Thanks for the help!

Return to “Beginners”