Hi,
I am facing a little issue while playing Audio with Pygame in my Python program.
Hardware: Raspberry Pi 2 Mod B
OS: OSMC
I need the audio to be played from the Audio/Headphone jack. In order to that in OSMC I have made a shell script that does changes the standard audio output from HDMI to Audio jack:
sudo systemctl stop mediacenter
sed -i 's#<audiodevice default="true">PI:HDMI</audiodevice>#<audiodevice>PI:Analogue</audiodevice>#g' /home/osmc/.kodi/userdata/guisettings.xml
sudo systemctl start mediacentero
And it works fine because after this if I play anything in OSMC the audio comes from Audio Jack. But when I play anything form Python using Pygame, the sound still comes from HDMI and not audio Jack…
Can someone please help me identify the issue and fix it.
The following command worked on Raspbian Wheezy
sudo amixer cset numid=3
0=auto
1=headphones
2=hdmi
sudo amixer cset numid=3 1 for jack
sudo amixer cset numid=3 2 for hdmi
not sure if it will work with osmc…but give it a try
If i am not mistaken you can play with config.txt to do that as well:
For [Video -> Composite][Audio -> 3.5mm jack]
hdmi_ignore_hotplug=1 #Use composite mode even if HDMI monitor is detected
For [Video -> HDMI][Audio -> 3.5mm jack]
hdmi_drive=1 #Normal DVI mode (No sound)
hdmi_drive=2 #Normal HDMI mode (Sound will be sent if supported and enabled)
Thanks, but I already know about the amixer thing, problem is it doesn;t work in OSMC.
Then try the config.txt way. It worked for Retropie. The only problem is that every time the osmc reboots, you’ll hear a ‘pop’ from the tv speakers…
I had
hdmi_drive=2
hdmi_ignore_hotplug=1