And here is the output of the pactl list short sinks command:
bash-5.1# pactl list short sinks
0 alsa_output.usb-soundcard-1.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
My app is a small nodejs script that tries to play some audio.
I tried to play some audio inside the audio container with the aplay command but no sound play out from the speakers.
I have no idea where the problem can be.
Can you suggest something?
Otherwise it looks like you’re on the right track assuming your goal is to output audio on the USB soundcard. If you’re still having problems, are you willing to share your client container Dockerfile so we can make sure it’s correct?
Hi @james-cws. I’m using your audio file. It’s stored in the file system and mapped in a docker container, but after your suggestion, I tried to load it while building. And it still doesn’t work.
Docker file:
FROM balenalib/up-board-node:16-run
ENV PULSE_SERVER=unix:/run/pulse/pulseaudio.socket
RUN install_packages python pkg-config make g++ libpulse-dev
RUN curl https://www.kozco.com/tech/LRMonoPhase4.wav --silent --output sample.wav
WORKDIR /usr/src
COPY . .
RUN npm install
CMD ["npm", "start"]
Hi aleksey, do you get any error messages when trying to play audio manually, ie trying to test the sample.wav using aplay?
The upboard isn’t a supported device for the audio block; you’re welcome to try but it’s going to require some experimentation & I can’t guarantee it will work. I see someone else has tried to get audio working in this balena os - upboard - audio playout issue - #18 by gzett forum thread, could you review the posts there and see if any of the suggestions help?
Hi @james-cws. Thanks. I have read provided thread before starting my thread. I don’t see any error while playing audio through aplay. It looks like it’s playing but I can’t hear anything.
@james-cws Hi. I tried to use same configuration for RaspberryPI 3 and I still can’t hear anything. I tried 2 difference output devices and hear nothing. And with RPI 3 I see some errors and warinigs in terminal.
It looks like you’re trying to validate your configuration for the upboard using a RPi 3? The error you’re seeing re DBUS is likely related to rpi4: snd_bcm2835 kernel module not being loaded on newer balenaOS versions · Issue #100 · balenablocks/audio · GitHub and is (probably) unrelated to the issues you were seeing with the up-board (assuming that you don’t see the same errors on the up-board). You could try some of the proposed solutions in the linked github issue for your RPi 3 or, if the goal is just to verify your configuration, you could test on an older version of balenaOS.
For your up-board, it’s very difficult to say where the issue is - by default, the up-board device tree directs onboard audio to the ADC on the hat header via I2S so it’s possible you may need to manually add support to the OS for your particular USB audio device. You can start your investigation by looking into the output of lsusb and lsmod to see if your USB device is being detected properly & what, if any, driver is being used. It may also be helpful to search around on up-board specific forums or message boards and verify that your USB audio device is supported at all on the up-board.