Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8013

Graphics, sound and multimedia • Pi Zero C program can system call aplay OK, but call to axmixer volume changes fail.

$
0
0
Been at this one for days...looking.

I have a Raspberry pi Zero 2W with a custom hat PCB to produce audio using a PAM8302 amplifier. My program runs in C making system calls to the amixer and aplay of alsaaudio. Sound always comes out. Adjusting volume previously worked.

Previously used PIGPIO and volume could be adjusted by system calls to amixer.
Updated code to WiringPi and now I seem to have lost amixer audio volume control in a system update I think.

SYMPTOMS:

1. Something happened in a system update, I seem to regret.
2. My C program still executes, calling aplay .wav files and audio comes out mono PAM8302 speaker just fine.

3. But set VOLUME commands to amixer - system("amixer -D pulse sset Master 45%") in the c program; no longer WORK. ERROR :?

4. While Terminal command ("aplay xx.wav') commands to play .wav files always work and I get sound out.

5. At the Terminal command line, can set volume using amixer fine, and the little volume icon on my screen changes, and HDMI output volume changes on speakers. Just not on bcm2835 to PAMaudio now.

6. HOWEVER: Running the C program now I always get this error: What does this mean?

ALSA lib pulse.c:242: (pulse_connect) PulseAudio: Unable to connect: Connection refused.

amixer: Mixer attach pulse error: Connection refused.


How to force to use bcm2835, raspi-config not so successful?



1. Raspinfo says
Bookworm 32 bit V12, with pipewire and wireplumber attempted

2. Default Playback recording through PulseAudio sound server.

3. Jacks HDMI and BCM2835.

4. Alsamixer stuck in PulseAudio F6 cannot shift input to BCm2835 always defaults back to pulse au
w

5. My c programs calls aplay . wav files, and these always work as previously.
But my amixer calls results in the following failures.

ALSA lib pulse.c:242: (pulse_connect) PulseAudio: Unable to connect: Connection refused.

amixer: Mixer attach pulse error: Connection refused.

Advice?,
Skotosman

Statistics: Posted by skotosman — Tue Feb 24, 2026 3:42 am



Viewing all articles
Browse latest Browse all 8013

Trending Articles