roccomuso / node-aplay

:musical_note: ALSA aplay wrapper for Node.js
30 stars 9 forks source link

Audio through 3.5mm Jack instead of HDMI #8

Open FabianEllenberger opened 6 years ago

FabianEllenberger commented 6 years ago

Hi there, first of all thank you for the library!

I'm playing a audio file with node-aplay. My Pi has an HDMI cable connection and speakers on the 3.5mm jack. The problem is that the audio from node-aplay will be played through HDMI and i would like to play the audio over the 3.5mm headphone jack. The HDMI should only display the RaspberryPi on a Screen but not the audio form node-aplay.

Do you by any chance know how to achieve this? I already configured the Pi to only play audio through the jack with amixer cset numid=3 1, but i assume that ALSA is somehow overwriting this config because as soon as i connect a HDMI cable the audio will be played through that.

I'm using resin.io by the way.

Thank you!

roccomuso commented 6 years ago

Did you try changing channel? #6 Try playing also with the aplay cli tool. If you're able to play the audio this way we can arrange a fix and improve the lib.

FabianEllenberger commented 6 years ago

@roccomuso i tried with {channel: 0}, {channel: 1} and {channel: 2}, it didn't change anything. Do you know which number represents the audio jack?

The sound works through jack if no HDMI cable is connected, so i think the lib is correct, i just need to somehow force audio jack always even if a HDMI is connected.