Audio through analog 3.5mm Jack

Hey guys,

I’m trying to force audio through the 3.5mm Jack but it keeps playing form the HDMI cable. I’m already using
amixer cset numid=3 1 in the config.txt but it didn’t have any effects.

I use a RaspberryPi3 and Resin OS 2.10.1+rev1 (prod). I’m also using ALSA which may be the problem and forces it back to HDMI.

If anyone had the same issue or does know any other way to force audio (maybe through the resin dashboard as a varibale) I would be super thankful!

Hi @fabianio!

One of the things that might be useful to look at is this documentation on how to modify the config.txt remotely through the dashboard: https://docs.resin.io/reference/resinOS/advanced/#config-txt – that’ll make it much easier to reproduce things going forward.

To select the mini jack for audio output, you can run amixer cset numid=3 1 on the command line, adding it to config.txt doesn’t really do anything.

You can test this out by connecting to the device terminal by going to the dashboard, clicking on the device in the list, and on the right hand side connect to your application terminal and running the command there.

Let me know if that works!

1 Like

@chrischabot

Thanks a lot, by running amixer cset numid=3 1 through the command line it worked as expected!

@chrischabot

Is there a way to run this command after each boot of the device? I tried it trough a Dockerfile.template but it was always fired while pushing to resin master while amixer is undefined. Thanks!

@fabianio probably the best route would be have a start.sh bash script that is in your CMD which will first run this command and then run your actual code. You can see something similar in our boombeastic wifi speaker example: https://github.com/resin-io-projects/boombeastic/blob/master/app/start.sh

That project also actually sets up the asound.conf here: https://github.com/resin-io-projects/boombeastic/blob/master/Dockerfile.template#L59 to route audio to the correct audio device, so that might be something to look at as well.

@shaunmulligan Thanks for the links! I got it working just by calling a start.sh through my package.json like so:

"scripts": {
    "preinstall": "bash deps.sh",
    "start": "bash start.sh"
  },

and then inside the start.sh i call the amixer and after that i start my app

#!/bin/bash

amixer cset numid=3 1
node /usr/src/app/server.js

Thanks again!