Changing sound output using code

đź•’ < 1 m read

Sound (by default) is usually outputted via the HDMI cable if your display have speakers, but what if your display does not have speakers & you want to change sound output to the audio jack instead? There is a chance that the auto-detection may have have misidentified your display to have speaker. If this were to happen, we can change the sound output manually.
Raspberry Pi 2

How do we do it?

It’s rather simple: we just have to open the terminal & enter a command line in it. For example, the following commend will switch the audio output to the audio jack:

amixer cset numid=3 1

As you can see, the following code changes the output of the sound to ‘1’, which represents the id of the audio jack output. If the last number is ‘0’, it means the sound output will be automatically detected, and if it is ‘1’, the sound will be outputted via the display through the HDMI cable. Below shows a summary of the IDs:

Id Output
0 Auto-detect (Default)
1 To display (HDMI)
2 To audio jack
Share your love

Leave a Reply

Your email address will not be published. Required fields are marked *