MPD volume

305 views
Skip to first unread message

Børge Strand-Bergesen

unread,
Jan 2, 2018, 2:37:32 AM1/2/18
to audio-...@googlegroups.com
Hi Guys, 

Happy New Year!


I'm confused by Linux audio these days. Do you know how MPD should be set up to use USB hardware volume control? I'm asking because I'm qualifying a new production-ready firmware build.

The Audio Widget firmware now defaults to using control in both UAC1 and UAC2. This is because Win10 will present a volume control to the user regardless of whether or not it is present in the hardware. 

While Win10 uses whatever volume control is there in the hardware first, I can't set it up with Linux (Mint 17). I believe it is in MPD's mixer setup. A few attempts with different settings haven't resolved anything. 

Windows, OS X and iOS apply volume control commands to the DAC. The Android versions I have tested seem to use software volume control. 

Generally, when a DAC is plugged in, the OS tries to learn a few things about it. At plug-in the OS reads the default volume setting. The very first time a DAC is recognized, the OS typically writes the default volume setting back to it and presents this setting to the user. The next time the DAC is plugged in, the OS instead writes a stored (host-side) volume setting. 

Now, my Linux test computer doesn't let me change the volume setting. Instead it writes an old default value which I only used for test purposes. So I'd like to delete the stored default and check whether Linux can control the DAC's hardware volume.


Cheers,
Børge

Paolo Saggese

unread,
Jan 2, 2018, 9:31:08 AM1/2/18
to audio-...@googlegroups.com
On 02/01/2018 08:37, Børge Strand-Bergesen wrote:

[...]
> Now, my Linux test computer doesn't let me change the volume setting.

what do you mean? Usually the ALSA setup store the "mixer" settings the
first time you add a new interface and then reload them as defaults at
the following reboot... but in no way it does prevent changing those
settings at run time.

But, be careful: just about all modern desktop distributions does not
use ALSA directly anymore. Usually they go through "pulseaudio" instead,
and that is what actually controls both software and hardware "mixers".

You can use the pulseaudio configuration GUI which is usually provided
by the various DE, or install and use e.g. "paman" and "pavucontrol".

Use "alsamixer" and/or "amixer" for direct lower-level control of the
ALSA interface.

> Instead it writes an old default value which I only used for test
> purposes. So I'd like to delete the stored default and check whether
> Linux can control the DAC's hardware volume.

The stored settings are stored here:

/var/lib/alsa/asound.state

you can change them using "alsactl" command, or just delete the file.


P.S.: IIRC, for MPD there is a specific configuration file option to
tell it whether to use hardware or software volume control. Same goes
for pulseaudio.


Ciao,
Paolo.

--
You can still escape from the GATES of hell: Use Linux!
Save a tree:
please don't print this e-mail unless you really need to.

Børge Strand-Bergesen

unread,
Jan 6, 2018, 9:58:56 AM1/6/18
to audio-...@googlegroups.com
Paolo, 

Thanks a lot! 

I was not aware of pavucontrol. It did the trick in UAC1. I have complete Widget UART debug of volume set and get commands, and can see that Linux now sets UAC1 to full volume when I request that in pavucontrol. Restarting the DAC has Linux send the new volume control data to it. So that one looks good now. The only thing lacking in that department is to have GMPC control the hardware volume through mpd. Not sure which mpd.conf details to use for that. 

However, in UAC2 I get no response from pavucontrol while running music through mpd. I can move the bar back and forth, but no commands are recorded by the DAC, and listening volume seems the same. Linux set the old default volume at DAC reset. Temporarily moving the asound.state file to a different directory may have been able to take care of the default, but I can't verify that after fixing it for UAC1. 

I also try UAC2 + VLC + pavucontrol. This does give me a volume control response in pavucontrol, but it seems it is only internal to the PC. The DAC does not receive volume change commands. This is also the behaviour I see from music players on Android on UAC2. 

Given my limited Linux audio skills I don't want to point fingers too much. BUT it does seem UAC2 hardware volume control has its limitations in both Linux and Android. UAC1 and UAC2 with volume control now works very well on Windows10, OS X and iOS. 

I have firmware (with and without verbose UART debug) which will run this on Audio Widget hardware. Let me know if you have hardware and want to give it a shot. 


Børge





--
You received this message because you are subscribed to the Google Groups "Audio-Widget" group.
To unsubscribe from this group and stop receiving emails from it, send an email to audio-widget+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paolo Saggese

unread,
Jan 8, 2018, 7:15:08 AM1/8/18
to audio-...@googlegroups.com
On 06/01/2018 15:58, Børge Strand-Bergesen wrote:

> The only thing lacking in that department is to have GMPC control
> the hardware volume through mpd. Not sure which mpd.conf details to
> use for that.

check mpd.conf man page:

https://linux.die.net/man/5/mpd.conf

Should be something like this:

audio_output {
type "alsa"
name "Audio Widget"
device "hw:MYDAC"
mixer_type "hardware"
mixer_device "hw:MYDAC"
mixer_control "name_of_the_alsa_mixer_control"
replay_gain_handler "mixer"
}

But, beware: in this example (type "alsa") you are accessing the ALSA
output and mixer device directly, by-passing pulseaudio. Obviously, the
volume control on pulseaudio will not work. Worse yet, PA may take over
the ALSA device itself, preventing MPD to do the same.

Thus, if you want to use PA, maybe you should rather configure MPD to
use PA interface instead of ALSA:

https://askubuntu.com/questions/555103/mpd-with-pulseaudio#555484

audio_output {
type "pulse"
name "My PULSE Device"
server "localhost"
}

("server" refers to the pulse audio server... which may also act as a
remote network audio server).

> However, in UAC2 I get no response from pavucontrol while running music
> through mpd. I can move the bar back and forth, but no commands are
> recorded by the DAC, and listening volume seems the same.

this may depend from the above... keep in mind that if you use ALSA
directly device names (particularly mixer device) may differ whan using
UAC2 rather than UAC1.

> I also try UAC2 + VLC + pavucontrol. This does give me a volume control
> response in pavucontrol, but it seems it is only internal to the PC. The
> DAC does not receive volume change commands. This is also the behaviour
> I see from music players on Android on UAC2.

Then perhaps you are not properly exporting the mixer interface in UAC2...

> I have firmware (with and without verbose UART debug) which will run
> this on Audio Widget hardware. Let me know if you have hardware and want
> to give it a shot.

I only have the old AB1.1 (the one with ESS9023), which I guess have no
volume control.


Ciao,
Paolo.

--
http://borex.lngs.infn.it/
http://www.facebook.com/saggese.paolo

Børge Strand-Bergesen

unread,
Jan 8, 2018, 8:01:44 AM1/8/18
to audio-...@googlegroups.com
Hi Paolo, 

Thanks! I'll try this out when I'm back at that computer. 

I believe the descriptors and mixer implementation in FW are good. They work on all other operating systems. But I don't rule anything out. There are way too many interpretations of the standards out there and hard to make something which works flawlessly all over. 

The newest FW should still work with your AB1.1, although I haven't tried it. 


Børge


Paolo Saggese

unread,
Jan 8, 2018, 8:48:19 AM1/8/18
to audio-...@googlegroups.com
On 08/01/2018 14:01, Børge Strand-Bergesen wrote:

> The newest FW should still work with your AB1.1, although I haven't
> tried it.

but how is the volume handled in such a case? In software within the FW?
Or even on that old board it was foreseen the the possibility to control
the DAC "hardware" volume?

Anyway, if it works either way I'll try it out. Please tell me which
firmware file to load(*).

I no longer use MPD, though. Since quite some time now I am using
LMS+C3PO+R2 (+Squeezer Android app) instead:

http://marcoc1712.it/

http://audiodigitale.eu/

As described in the links I'm using a fork of SoX to convert PCM to DSD
(128x or 256x) in real time on the PC, then feeding it via an Xmos-based
UAC2->I2S interface to an AK4490 DAC.
By doing so the DAC internal PCM to bitstream conversion is by-passed
and replaced by SoX algorithms. Believe it or not, such "software DAC"
(sort of) sounds better than the same hardware directly driven in PCM.
Moreover, it offers a lot of possibilities for "fine tuning" the sound
to your own taste and system by acting on SoX resample & SDM options.
You should try that! ;-)

(*): bear in mind I only have Linux, using "dfu-programmer" with the
attached script to load the firmware. Is that still OK? It have been a
long, long time since the last time I have updated the FW on my AB...


Ciao,
Paolo.

--
program-widget.sh
Reply all
Reply to author
Forward
0 new messages