# Sound via 3.5mm jack on Raspberry Pi 4 within container

**URL:** <https://forums.balena.io/t/sound-via-3-5mm-jack-on-raspberry-pi-4-within-container/329335>\
**Category:** balenaOS\
**Created:** [June 22, 2021, 11:31am UTC](https://forums.balena.io/t/sound-via-3-5mm-jack-on-raspberry-pi-4-within-container/329335 "2021-06-22T11:31:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bversluijs](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/bversluijs/32/3954_2.png) [@bversluijs](https://forums.balena.io/u/bversluijs)\
**Post date:** [June 22, 2021, 11:31am UTC](https://forums.balena.io/t/sound-via-3-5mm-jack-on-raspberry-pi-4-within-container/329335/1 "2021-06-22T11:31:25Z")

</div>

Hi,

I’m trying to setup a simple audio player within my application.  
I’ve heard about balena-sound, but I want to integrate some audio into my application, so balena-sound will not help me with this. I’ve used it as an example though!

Starting at the beginning, I’m stuck already. I have an Alpine container (`balenalib/raspberrypi4-64-alpine-node:12`), where my application is running. I’ve added the `alsa-utils` package and tried to do the speaker-test via the 3.5mm jack. But not a sound is coming out of my speakers.

Checking with `aplay`, I’m getting the following output:

```auto
$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=Headphones
    bcm2835 Headphones, bcm2835 Headphones
    Default Audio Device
sysdefault:CARD=Headphones
    bcm2835 Headphones, bcm2835 Headphones
    Default Audio Device

$ aplay -l
****List of PLAYBACK Hardware Devices****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7

```

So there is a bcm2835 Headphones card found.  
I’ve seen people getting success with using `amixer cset numid=3 1`, but that command doesn’t succeed. Here’s the output of some `amixer` commands:

```auto
$ amixer cset numid=3 1
amixer: Cannot find the given element from control default

$ amixer contents
numid=2,iface=MIXER,name='Headphone Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=1,iface=MIXER,name='Headphone Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=-10239,max=400,step=0
  : values=400
  | dBscale-min=-102.39dB,step=0.01dB,mute=1

```

On other forums, I saw that there should be another card, the HDMI card. But it just shows the headphones.

* * *

Some details about the Pi itself:  
Raspberry Pi 4 (64-bit image)  
BalenaOS 2.73.1+rev1 (development image)  
Supervisor v12.4.6

Contents of `config.txt`

```auto
dtoverlay=miniuart-bt
dtoverlay=pi3-miniuart-bt
enable_uart=1
arm_64bit=1
avoid_warnings=1
disable_splash=1
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on
gpu_mem=16

```

Container is running privileged, UDEV and dbus are both enabled.

* * *

Any help would be welcome!

---

<div class="post-metadata">

**Author:** ![bversluijs](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/bversluijs/32/3954_2.png) [@bversluijs](https://forums.balena.io/u/bversluijs)\
**Post date:** [June 22, 2021, 11:50am UTC](https://forums.balena.io/t/sound-via-3-5mm-jack-on-raspberry-pi-4-within-container/329335/3 "2021-06-22T11:50:44Z")

</div>

Okay so, skip all that.  
Someone moved my Raspberry Pi and the 3.5mm jack was in the wrong Raspberry Pi.  
So that wasted some hours of my life 🙃

---

<div class="post-metadata">

**Author:** ![anujdeshpande](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/anujdeshpande/32/3155_2.png) [@anujdeshpande](https://forums.balena.io/u/anujdeshpande)\
**Post date:** [June 22, 2021, 12:07pm UTC](https://forums.balena.io/t/sound-via-3-5mm-jack-on-raspberry-pi-4-within-container/329335/4 "2021-06-22T12:07:32Z")

</div>

Hah!  
We’ve all been there - no worries!
