Switching audio output between jack and HDMI on RetroPie

Switching audio output between jack and HDMI on RetroPie

RetroPie is a great multi-emulator project for the Raspberry Pi, but I noticed that its auto-detect for which audio device to use seems a bit erratic. I’ve speakers plugged into the 3.5mm jack, as the HDMI cable runs to a speaker-less monitor, and usually (but not always) RetroPie defaulted to squirting sound out the HDMI port.

There’s two ways of fixing this. Firstly, you can change the audio output for the current session (i.e. until you reboot it) by issuing this command to force the output to the 3.5mm jack:

amixer cset numid=3 1

or this command to force it down the HDMI cable:

amixer cset numid=3 2

To run this command, either switch to another terminal session (e.g. Ctrl-Alt-F2), and log in as user pi, password raspberry (defaults, unless you’ve changed them), then Ctrl-Alt-F1 to switch back to the GUI.

Alternatively, from another machine, you can SSH into your Pi and run the command in the shell there.

To make this a permanent change, you need to run RetroPie-Setup. Get into a terminal using either of the above two methods (Ctrl-Alt-F2 or SSH) and enter:

cd RetroPie-Setup
sudo ./retropie_setup.sh

This will bring up the config screen. Choose option 8, “Configure audio settings”.

retropiesetup1

Then choose either Headphones (for the 3.5mm jack) or HDMI as necessary.

retropiesetup2

Choose OK, then reboot!

 

0 Comments

  1. Is there any way to have both?

    I have built an arcade table and I put an extension socket on the side to extend one of the USB sockets and the 3.5mm audio.

    I would like to run the sound through HDMI to the speakers in the monitor but have the ability to plug in external speakers to my extension socket.

    I tried extending from the headphone socket on the TV but it stops the sound from the inbuilt speakers and when plugged o to the Pi I get nothing.

    The guide above is great and allows me to switch but would like both to work simultaneously.

    Rich
  2. Pingback: Happy Friday! – First Edition – Fun With RetroPie – vBrisket

  3. how do you do this on retrorange pi 3.01 none of the stuff i found online works theres no audio links in the retropie setup and none of the sudo codes work they just messed up the audio mixer and caused an error to scroll over and over all over the es gui

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.