Issue with amixer "Simple mixer control" - different components in nodered exec node and in terminal

Dear all, I have an issue and do not know how to solve it. It seems pretty simple, but I searched everywhere but could not find a solution, and also not derivate any solution.
So there we go. I am using a Raspi 4b+
I have an exec node in my Nodered where I want to change the volume.
When running it in the terminal, a simple amixer sset Master 3%+ does the trick.
Because, when I run "amixer" in the terminal, I get this:

Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 33309 [51%] [on]
  Front Right: Playback 33309 [51%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 65536 [100%] [on]
  Front Right: Capture 65536 [100%] [on]

In the exec node in Nodered, it does not work. When I simply run amixer, I get this in the payload:

Simple mixer control 'Headphone',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback -10239 - 400
  Mono: Playback 0 [96%] [0.00dB] [on]

So, the issue is for me pretty clear: in the terminal the volume is controlled by the "Master", it works wonderfully, and I can also run mp3s via mplayer and it is fine.
In Nodered, there is no Master, but the "Headphone". I even turned off the "AV Jack" of the raspberry pi, so that it does not show anymore in the raspi-config - there I have only the USB Audio in the system options -> Audio , which is what I am using as the output speaker (i.e. it has only an USB cable, no sound jack).

So in my simple world, the solution would be to force the "amixer" in nodered to use the "Master" instead of "Headphone". Is this the solution? If it is, how to achieve it? If not, anybody has any idea on how to do it?

Thanks a lot!

Short update: the edit of the alsa config file has worked, now the exec node using mplayer also outputs the sound to my usb device.
But the volume with amixer sset still does not work, it works only if I put "Headphone", which is not what I want.

For future reference, the USB Device worked out of nodered exec node after changing this:

To edit your default values you alsa config file as others have stated:

sudo nano /usr/share/alsa/alsa.conf

The specific lines you will want to change are a few pages down. You can search with Cntl+W or just scroll down.

Change:

defaults.pcm.card 0
defaults.pcm.device 0

To:

defaults.pcm.card 1
defaults.pcm.device 0

link: https://superuser.com/a/1274873

1 Like

And problem solved...
just had to adjust the exec node to select the card 1, which is my USB Device.
so the amixer command that worked (as an example) was:

amixer -c 1 sset PCM -M

That's it. I am marking as a solution.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.