Audio through analog 3.5mm Jack with resin-wpe

Hello, I hope you’re having a magnificent day.

I’m trying to force audio to play through the 3.5mm audio jack on a Raspberry Pi 3, because the Adafruit TFT screen I’m using doesn’t support audio.

I used WPE Webkit for the RaspberryPi as a starting point.

I’ve followed the advice in this similarly titled post, but when I run amixer cset numid=3 1 on the command line I get the following

root@0dd50e6:/usr/src/app# amixer cset numid=3 1
bash: amixer: command not found

I’ve tried this with the unmodified WPE Webkit for the RaspberryPi repo and get the same result, however my actual app is multi-container, with the wpe as one container, and node:8 as the image for another (I get the error in a console in Host OS, and in both containers).

There is communication between containers as the node container is running socket.io, meaning a workaround that would work for me would to have the node container play the audio instead of wpe. Not sure if that helps, but I’m at the end of my tether with this and open to trying anything.

Best, Hoss.

@hossgifford It sounds like amixer isn’t installed in any of your containers. Amixer itself is provided by the alsa-utils package, which you’ll need to install. If you add that to the container, does the amixer command work for you?

I’ve added the following to my node:8 container Dockerfile.template

# Install other apt deps
RUN apt-get update && apt-get install -y --no-install-recommends \
  apt-utils \
  alsa-utils libasound2-dev && rm -rf /var/lib/apt/lists/*

This did allow me to implement the start.sh file with

#!/bin/bash

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

Now amixer cset numid=3 1 does appear to run okay, but the wpe container still doesn’t play audio through the 3.5mm jack.

I think to start with you’ll probably want to use amixer this in the WPE container, not your node container. I’m not an expert on either ALSA or WPE, but it sounds like right now that’s where the audio is managed, so that’s where you’ll need to reconfigure it. Once you’ve got that working, you can potentially look at more complex solutions to manage it from the other container, if you need to.

Thanks for the prompt responses.
Here’s the workaround that resolved my particular situation.

I added the following to my node:8 container.

RUN apt-get update && apt-get install -y --no-install-recommends \
  apt-utils \
  sqlite3 \
  alsa-base alsa-utils && rm -rf /var/lib/apt/lists/*

The addition of alsa allowed me to run amixer cset numid=3 1 in my start.sh file as described here.

I then used node-aplay in this node:8 container to play the sound when requested through socket.io that I’m using for comms with the wpe container and connected devices.

This obviously won’t work for everyone, as it doesn’t give you direct sound output from the wpe container, but for my use case where I just need to trigger the occasional sound effect, it works great.

Thanks again for your help.
Best, Hoss.

@hossgifford Great! Glad to hear you’ve got that sorted. Let us know if you hit any other problems.