Page 1 of 5

How-to: Use USB Audio in Retropie v3.7

Posted: Thu May 12, 2016 9:06 pm
by chiz
For those who's considering to go the USB audio route (vs. the PWM method), I've prepared this guide to help anyone who's at a loss on how to configure their Retropie installation for USB audio use. Note you'll need a USB keyboard attached or you can SSH into your system assuming you have configured it already for access within your home network.

Steps:
1. Attach the USB audio dongle into one of the USB ports connected the RPi. Reboot the system.

2. Once EmulationStation has loaded, exit from it by pressing F4. This will take you to the terminal.

3. Check if your USB audio has been detected by Raspbian Jessie by typing the command below:

Code: Select all

pi@retropie:~ $ lsusb
Output should be:

Code: Select all

Bus 001 Device 007: ID 0d8c:0014 C-Media Electronics, Inc.
Bus 001 Device 004: ID 0424:2517 Standard Microsystems Corp. Hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The C-Media Electronics, Inc line shows that the USB audio device is detected.

4. Once we're sure the USB audio device is detected, let's check the order of priority of the sound cards being used by the system. Do so by typing this command:

Code: Select all

pi@retropie:~ $ cat /proc/asound/modules
Output should be:

Code: Select all

 0 snd_bcm2835
 1 snd_usb_audio
As you can see from the output above, the snd_bcm2835 is the built-in sound card but we want the system to use snd_usb_audio

5. We can change and force the system to load the sound cards in a different order by creating a sound configuration file. Create the file by using the command below:

Code: Select all

pi@retropie:~ $ sudo nano /etc/modprobe.d/alsa-base.conf
You will then enter the Nano editor environment and type the following lines:

Code: Select all

options snd_usb_audio index=0
options snd_bcm2835 index=1
options snd slots=snd-usb-audio,snd-bcm2835
Afterwards, press Ctrl+X to exit and answer Yes when prompted to save.

6. Reboot the system, exit EmulationStation once again to go to the terminal.

7. If you've successfully completed all the above steps, you should see the output below when you type the command:

Code: Select all

pi@retropie:~ $ cat /proc/asound/modules
Output should be:

Code: Select all

 0 snd_usb_audio
 1 snd_bcm2835
Notice that the order has changed and it's now the snd_usb_audio that's on top of the list with an index of 0

8. Test the sound by going to EmulationStation and playing a game. You should immediately hear EmulationStation sounds when you go select from the list of games.

Load EmulationStation by typing the following command:

Code: Select all

pi@retropie:~ $ emulationstation
Good luck!

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Thu May 12, 2016 11:59 pm
by Fleder
Thanks for sharing! Really helpful.

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Fri May 13, 2016 1:56 am
by grenade44
Thanks for this, are you using a amplifier? Or Gameboy speaker soldered to usb audio?

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Fri May 13, 2016 11:04 am
by Ganreizu
Bookmarked! :D Thank you~ Now all we need to do is document the physical connections and set up and we'll have a guide ready to go for when the wiki is up.

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Fri May 13, 2016 4:27 pm
by Robvp
How is the sound quality and volume compared to the pi's sound?

I'm currently debating wether to use this or get the output from the pi

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Fri May 13, 2016 4:41 pm
by crispy_tofu
Thanks for sharing chiz, this will come in very handy! :D

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Fri May 13, 2016 8:41 pm
by chiz
Glad you liked it guys. Let me know if you find anything incorrect or you're having problem following the step so we can improve or add more information to the guide.
grenade44 wrote:Thanks for this, are you using a amplifier? Or Gameboy speaker soldered to usb audio?
No I'm not. If you'll check my build log, you'll find a set of pics showing I measured the volume levels using the USB audio dongle connected to a micro speaker and it does sound decent enough. I'm waiting for a 2W micro speaker and would test if it will produce a louder sound.

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Fri May 13, 2016 9:47 pm
by 1461748123
Thanks for the tutorial! Making this post sticky, also moving it to the RetroPi section :)

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Mon May 30, 2016 12:05 am
by dirtybeagles
Just completed my setup, thanks a ton for putting this together!!

Re: How-to: Use USB Audio in Retropie v3.7

Posted: Tue Jun 14, 2016 12:56 am
by BMBteke397
So, possible dumb question. If you use the USB audio would that bypass the HDMI audio if you decide to plug your Gameboy Zero into a TV? Would it still force the audio out through the Speaker or headphones instead of out to the TV?