Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: volume control bug when turning off DAC
#1
Hi,

First post.

I've recently installed Moode audio on a rpi4. The pi is connected to a Loxjie D30 DAC via USB, which I turn off when not in use to save power.

I've noticed that when the DAC has been off, and you turn it on and start playing, you can get into a situation where the volume is greater than zero, but reports as -127dB (normally -127dB would be volume level zero).

For example, the last time I turned on the DAC and hit play, moode's volume was at 97/-127dB. See attached screenshot.

When this happens no audio is heard until you touch the volume dial. My theory is that  the volume really is 0, just the volume dial UI hasn't updated. Perhaps moode sets newly attached devices to volume zero to avoid you blowing your head off with 100% volume?

Maybe you can repro this with other USB dacs by unplugging and re-plugging in the DAC?

It's not a big deal, but it did confuse me for a while, as I didn't know why I wasn't hearing anything. Ideally either the volume would restore to the last level it was at for this device, or 0 (but make sure the UI reflects that).

Cheers

P.S. Thank you for developing Moode


Attached Files Thumbnail(s)
   
Reply
#2
Where do you control the volume? If you use the DAC's volume knob, the logical setting would be "Fixed (0dB)", so that moOde would always play at max volume level, and the device would attenuate it on its own. The volume level will be remembered by the device.
Reply
#3
I've set up Moode to control the hardware volume control of the DAC so that I can adjust the same volume control with the remote control for the DAC and my phone via the web interface. Or at least that was the plan anyway.
Reply
#4
Couple things:

1. If you change DAC volume using its own knob the new dB value won't be communicated back to moOde. The volume settings will be out of sync at that point which is not a good situation to be in.
2. It can take some seconds after turning on a USB DAC for Linux/ALSA to recognize it.

As far as the specific issue you are experiencing can you create a precise list of steps that could be used to try and reproduce it?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
Here are the results of some experimentation.

Steps:

 - Plug in Loxjie D30 via USB into the Raspberry Pi 4B running Moode 9.2.5 2025-02-23.
 - In Moode settings, set the D30 to the output device and select hardware volume.
 - Play some music and adjust volume to comfortable listening level. For my headphones, this was "45 (-21dB)" in Moode's web UI.
 - Switch OFF D30 by holding down physical volume knob on front panel.
 - Switch ON D30 by again holding down the physical volume knob.
 - Press play on Moode's web UI.
 - Now no audio is heard. Complete silence. This is unexpected to me.
 - If you go to Moode's volume panel in the web UI it displays "45 (-127dB)"
 - If you adjust the volume in Moode's web UI to anything other than the current value, audio comes back.

I was unable to reproduce this with more basic dongles like the Samsung USB C to 3.5mm dongle (which Moode doesn't offer the option of hardware volume control for) or the Venture Electronics Abigail Pro. For the latter, Moode offered me a hardware volume control setting, which when used worked flawlessly even after disconnecting and reconnecting.

Another thing I noticed with the Loxjie D30 when used with "hardware" volume control, is that setting the volume in the Moode web UI doesn't update the D30's volume on its front panel screen. From this I conclude that Moode isn't changing the hardware volume of the D30 after all. Or perhaps the D30 has two hardware volume controls, one controlled by the knob, another controlled by the USB host. Not really sure.

After this I thought "oh well, let's just set Moode to fixed volume and I can just use the D30 remote control". Sadly the "no audio" problem still presents when you turn the D30 off and on, but this time because there is no volume control to speak of in the Moode web UI, you can't adjust the volume to get the audio back!

What do you reckon? Some quirk with the way the hardware volume control works on the D30? Is there anything I can try?
Reply
#6
The observation below would suggest the DAC may have a volume implementation thats not compatible with Linux/ALSA.

Code:
Another thing I noticed with the Loxjie D30 when used with "hardware" volume control, is that setting the volume in the Moode web UI doesn't update the D30's volume on its front panel screen. From this I conclude that Moode isn't changing the hardware volume of the D30 after all. Or perhaps the D30 has two hardware volume controls, one controlled by the knob, another controlled by the USB host. Not really sure.

For your steps, start by posting the output of the 2 commands after step 3.

1. Plug in Loxjie D30 via USB into the Raspberry Pi 4B running Moode 9.2.5 2025-02-23.
2. In Moode settings, set the D30 to the output device and select hardware volume.
3. Play some music and adjust volume to comfortable listening level. For my headphones, this was "45 (-21dB)" in Moode's web UI.

Code:
aplay -l

amixer scontrols

4. Switch OFF D30 by holding down physical volume knob on front panel.
5. Switch ON D30 by again holding down the physical volume knob.
6. Press play on Moode's web UI.
7. Now no audio is heard. Complete silence. This is unexpected to me.
8. If you go to Moode's volume panel in the web UI it displays "45 (-127dB)"
9. If you adjust the volume in Moode's web UI to anything other than the current value, audio comes back.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
OK. Music is playing:

Code:
edd@moode:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AUDIO [LOXJIE AUDIO], device 0: USB Audio [USB Audio]
 Subdevices: 0/1
 Subdevice #0: subdevice #0
card 1: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 2: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

Code:
edd@moode:~ $ amixer scontrols
Simple mixer control 'LOXJIE AUDIO ',0
Simple mixer control 'LOXJIE AUDIO ',1

And for good measure:

Code:
edd@moode:~ $ amixer controls                                                                                                  
numid=6,iface=CARD,name='LOXJIE Internal Clock Validity'
numid=2,iface=MIXER,name='LOXJIE AUDIO  Playback Switch'
numid=3,iface=MIXER,name='LOXJIE AUDIO  Playback Switch',index=1
numid=4,iface=MIXER,name='LOXJIE AUDIO  Playback Volume'
numid=5,iface=MIXER,name='LOXJIE AUDIO  Playback Volume',index=1
numid=1,iface=PCM,name='Playback Channel Map'

and:
Code:
edd@moode:~ $ amixer
Simple mixer control 'LOXJIE AUDIO ',0
 Capabilities: pvolume pswitch
 Playback channels: Front Left - Front Right
 Limits: Playback 0 - 127
 Mono:
 Front Left: Playback 126 [99%] [-1.00dB] [on]
 Front Right: Playback 126 [99%] [-1.00dB] [on]
Simple mixer control 'LOXJIE AUDIO ',1
 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback 0 - 127
 Mono: Playback 127 [100%] [0.00dB] [on]

I'm not familiar with ALSA, but do I see it right that the DAC expose these two volume controls, one that can attenuate individual stereo channels, and another which can't?

Moode is adjusting mixer control #0. I can adjust the volume in the web UI and see that value change.

For example Moode web UI volume 30:
Code:
 Front Left: Playback 96 [76%] [-31.00dB] [on]
 Front Right: Playback 96 [76%] [-31.00dB] [on]


Moode web UI volume 60:
Code:
 Front Left: Playback 114 [90%] [-13.00dB] [on]
 Front Right: Playback 114 [90%] [-13.00dB] [on]

Not sure why the percentages don't agree there...

One theory then would be that mixer control #1 is the actual hardware control of the DAC (and #0 just attenuates individual channels). But the volume display on the LCD screen on the DAC reads 26 (out of 60) and ALSA displays the mixer control #1 volume as:

Code:
 Mono: Playback 127 [100%] [0.00dB] [on]


Which again doesn't make sense. 26 isn't full blast, as this output would suggest. Turning the volume down using the physical knob on the unit doesn't vary any ALSA mixer output.

Still unsure why fixed volume in Moode doesn't work at all. Many mysteries.

Let me know if there's any other output that would help.
Reply
#8
Also tried fiddling with the value of mixer control #1 with commands like 'amixer sset 'LOXJIE AUDIO ',0 64'. This did change the volume of the music i was listening to, but didn't update the volume reading on the front display of the DAC.

This is weird.

To be honest I'd be happy if we could just get this working right with 'fixed output' in moode at this point.
Reply
#9
Oh, I forgot to put the output of of amixer right after turning the DAC off and back on and pressing play.


Code:
edd@moode:~ $ amixer
Simple mixer control 'LOXJIE AUDIO ',0
 Capabilities: pvolume pswitch
 Playback channels: Front Left - Front Right
 Limits: Playback 0 - 127
 Mono:
 Front Left: Playback 22 [17%] [-105.00dB] [on]
 Front Right: Playback 0 [0%] [-127.00dB] [on]
Simple mixer control 'LOXJIE AUDIO ',1
 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback 0 - 127
 Mono: Playback 127 [100%] [0.00dB] [on]


So looks like volume control #0 isn't initialised properly when the dac is power cycled. The audio sample rate shows on the front panel, so it's definitely being sent a signal, just it's outputting it so quietly as to not be heard.
Reply
#10
Hey I fixed it!

I set the volume to 100% in Moode and ran:

Code:
sudo alsactl store


Got this advice here: https://unix.stackexchange.com/questions...sa-devices
Reply


Forum Jump: