Can't select headphones output on Pi

I can’t get the sound output of my Xojo app on a Pi 3 to come out of the headphone jack instead of the HDMI.

More strangely I have no problem reassigning the output of other sources, in Terminal but even with a shell command within the Xojo app. So I can have music playing on the Chrome browser through HDMI and successfully move it to the headphones with the Xojo shell command “sudo amixer cset numid=3 1”. But the output of my Xojo app (playing an MP3 file) still comes out on HDMI. Quite clever, because I’m not sure the Pi is even supposed to be able to talk separately to both outputs at once…

To test this I am using the MP3 player here

Any suggestions anyone ?

Some more info, I have now connected up an Adafruit board and speaker that takes an I2S digital sound signal off the GPIO pins and this also fails to work with my Xojo app but is quite happy to play sounds from the Chrome browser or the command line. Is Xojo perhaps hardcoded to only send sound to the HDMI output ? Cheers.

Good morning Richard,

You posted before I did :slight_smile: I just ran into the same problem and am not able to play an mp3 on my Raspberry Pi 3 B+ through the headphone jack. Similar to your experience, playing a YouTube video correctly plays the sound through the headphone jack. Here are the specifics of my platform: compiled on Windows 10 with Xojo 2018 r1.1, Raspberry Pi 3 B+ with the Stretch Operating system.

I’ll start troubleshooting this morning to see if there is a workaround.

Warm regards.

Hi Richard,

Here are a few different results:

  1. Created a simple sound program on Xojo 2017 instead of Xojo 2018 r1.1 - No sound. This worked on previous examples.

Here is the code that doesn’t work:

Dim f as FolderItem f = GetFolderItem("Recording.mp3") Dim s As Sound s = f.OpenAsSound s.Play

  1. Typed the following command in a terminal in Raspberry Pi:
omxplayer -o local Recording.mp3

This command correctly played the sound in the headphone jack.

  1. Created the following program

Dim sh as New Shell sh.Execute("omxplayer -o local Recording.mp3")
This code played the sound in Xojo 2017 r3 through the headphone jack.

Could you try this on your machine to see if it works?

Edit: Made grammatical changes

Thanks Eugene, that’s helpful.

With both Xojo 2017r3 and 2018r1 running from a Mac to my Pi 3 running Raspian Stretch I can get the shell omxplayer to play an MP3 on the HDMI or the headphone as I choose.

This does not play the sound through the I2C board I have connected but mpg123 does.

So I can now do what I wanted to do. A rather annoying work around but at least it works. Thank you for making good progress on this.

Cheers, Richard