MPD Volume Control with Multiple Outputs - keeping them at same level

Need help with MPD?
Post Reply
tmassey
Posts: 1
Joined: June 1st, 2019, 11:06 pm

MPD Volume Control with Multiple Outputs - keeping them at same level

Post by tmassey » June 2nd, 2019, 1:10 am

Hello!

tl;dr: With multiple outputs, how can I make MPD set the volume to *all* outputs (enabled or not) when the volume is changed (or when the output is enabled)? It's really disturbing to turn on a zone and have it blast at full volume because the last person turned that zone off with the volume up...


I am using MPD with multiple outputs: I have speakers in several rooms in my home wired back to a single computer running MPD, with multiple USB sound d(evices attached to it. I'm replacing a Raspberry Pi running Linux and using PulseAudio. The Debian MPD is so old I can't get support, so at least for testing I decided to do this on Windows and use the Windows builds supplied directly from the MPD website.

So far, so good: I have MPD up and running, with multiple zones. (And with a *LOT* less out-of-sync than Linux/PulseAudio, which was a big complaint before.) However, volume with multiple outputs works very differently. With Linux and PulseAudio, the volume of all outputs stay in sync. Let's say I have 2 outputs, both enabled, and I set the volume to 80. If I disable an output, then change the volume to 20, when I turn the output back on, it gets set to 20: both outputs play quietly, and MPD shows the volume as 20. I assumed that's how it was supposed to work -- it's certainly what I expected and wanted to happen.

With Windows, though, it is *not* working that way. If I have 2 outputs enable and set the volume to 80, then disable one, change the volume to 20, and enable the output, I'll have one set of speakers playing loudly and one quietly, and MPD will show the volume as the *average* of the two!

I had actually experienced this previously, when I tried to switch to ALSA instead of PulseAudio. I thought this behavior was a bug -- it certainly doesn't seem to make a lot of sense to me to work that way compared to the way it was working with PA. I opened a bug report which got no followup (even when I reproduced it with the latest and greatest MPD: https://github.com/MusicPlayerDaemon/MPD/issues/189 ).

This time, I even tried to dig into the source code. From what I can find, it seems the volume as average-of-output-volumes is intentional, so I assume that what I'm experiencing is intended. But it makes the system *very* difficult to use properly. Someone will turn a zone off when listening at an elevated level, then later turn things down, and wander back into that room, turn it back on -- and wake up the children napping in the next room, and make their wife *very* annoyed... :) Never mind the fact that this makes a volume level effectively useless for knowing what anything is actually playing at. If you can never *see* individual volume levels, and if you can't intuitively or directly *set* individual volume levels, why are different simultaneous volume levels even possible?

It seems that volume with multiple outputs is an issue for a number of people (for example, a past discussion: https://github.com/MusicPlayerDaemon/MPD/issues/434). I know some people want much more complexity: per-zone volume, with certain volume scaling factors (to compensate for different rooms), etc. Sure, I'd take all that (though my wife probably wouldn't), but I have separate amplifier channels for each zone: I use the gain on the amplifiers to make sure that the volume is consistent in each room, as God intended... :)

All I want is a system that works the way it does with Linux and PA: one master volume. The current volume is the volume for all zones, whether they're enabled or not. No surprises when a zone is enabled: you're going to get the current volume, and all zones always have the same volume -- or off. Sure, if there were a fully-fleshed per-output volume system, that would be great. But until then, let's at least make a single volume work across output work properly!

Is this something that I can get with MPD as it is right now? After all, this is how it works with PA!

Please let me know if you have any questions.

MPD Version (downloaded today from musicpd.org):

Code: Select all

C:\mpd\bin>mpd --version
Music Player Daemon 0.21.9 (0.21.9)
Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2018 Max Kellermann <max.kellermann@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
 simple proxy

Storage plugins:
 local nfs curl


Decoders plugins:
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [opus] opus ogg oga
 [dsdiff] dff
 [dsf] dsf
 [hybrid_dsd] m4a
 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr an
im apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct di
vx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2
t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4
 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg om
g opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx
 str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wa
v webm wma wmv wsaud wsvga wv wve
 [pcm]

Filters:


Tag plugins:


Output plugins:
 null httpd recorder winmm

Encoder plugins:
 null vorbis opus lame wave flac

Input plugins:
 file curl ffmpeg nfs

Playlist plugins:
 extm3u m3u pls xspf asx rss flac cue embcue

Protocols:
 http:// https:// gopher:// rtp:// rtsp:// rtmp:// rtmpt:// rtmps:// nfs://

Other features:
 ipv6 tcp

C:\mpd\bin>

mpd.conf:

Code: Select all

music_directory			"C:\\mpd\\data\\music"
playlist_directory		"C:\\mpd\\data\\playlists"
db_file				"C:\\mpd\\data\\database"
log_file			"C:\\mpd\\data\\log"
state_file			"C:\\mpd\\data\\state"

restore_paused			"yes"

zeroconf_enabled		"yes"
zeroconf_name			"Windows Test MPD Music Player"

audio_output {
	type		"winmm"
	name		"Living Room"
	device		"Speakers (USB Sound Device       )"
	mixer_type	"hardware"	# optional
}

audio_output {
	type		"winmm"
	name		"Master Bedroom"
	device		"Speakers (2- USB Sound Device       )"
	mixer_type	"hardware"	# optional
}

Post Reply