additional tags support (replay gain)

Discuss client development (or even MPD development if you feel so inclined), ask questions about the client libs, MPD feature requests from client developers, etc...
Post Reply
sf666
Posts: 9
Joined: November 10th, 2018, 6:38 am

additional tags support (replay gain)

Post by sf666 »

Hi,

I'd like to propose a protocol enhancement for supporting ReplainGain Tags:

- replaygain_album_gain
- replaygain_album_peak
- replaygain_track_gain
- replaygain_track_peak

The "currentsong" command should then also be able to dump those tags.

Best regards

SF
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: additional tags support (replay gain)

Post by max »

Why?
sf666
Posts: 9
Joined: November 10th, 2018, 6:38 am

Re: additional tags support (replay gain)

Post by sf666 »

I have experimented with applying replay gain by MPD. At the moment I'm not quite satisfied with the result.

I'm using an USB DAC with the following configuration:

Code: Select all

replaygain                      "track"
replaygain_missing_preamp       "-15"

zeroconf_enabled		"yes"
zeroconf_name			"MPD Wohnzimmer"

audio_output {
       	type              	"alsa"
       	name              	"MA 9000"
       	device            	"hw:Audio"
	mixer_type 		"hardware"
	mixer_device 		"hw:Audio"
	mixer_control 		"PCM" 
	replay_gain_handler	"mixer"
	auto_resample   	"no"
	auto_channels   	"no"
	auto_format     	"no"
}
Songs with a high replay gain level (i.e. +10) that are played at 100% (mpc volume) are definitely louder (to my personal listening experience) than other tracks which are played let's say at 25% by MPD.

I'd like to implement an external solution which fits better to my setup. Since I'm streaming the music files from a media server to MPD I have no direct access to the files and can therefore not read the tags by myself. Hence, I'd like to read this info from the "currentsong" command and do the volume adjustment by an external script.
sf666
Posts: 9
Joined: November 10th, 2018, 6:38 am

Re: additional tags support (replay gain)

Post by sf666 »

Oh, maybe it links somehow to this feature request:

https://github.com/MusicPlayerDaemon/MPD/issues/434
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: additional tags support (replay gain)

Post by max »

sf666 wrote: January 8th, 2020, 12:07 pmI'd like to implement an external solution which fits better to my setup.
If there is a problem with MPD's replaygain implementation, then it should be fixed in MPD. Offering you a way to get around MPD means it is less likely that you'll fix MPD and submit your code. So no, this doesn't sound like a good feature.
sf666
Posts: 9
Joined: November 10th, 2018, 6:38 am

Re: additional tags support (replay gain)

Post by sf666 »

I'm actually not sure if MPD is able to fix it. Another discussion to this issue:

https://github.com/MusicPlayerDaemon/MPD/issues/219

proposes to to leave everything as it is and implement an API. This sounds like there is no (good) general solution.

Furthermore, I'm uncertain if the master volume (of the DAC) has to be taken into account for calculating the correct volume level. However, MPD is nighter able to read nor to adjust, the master volume of the DAC. I think this is one reason why this client hack is documented:

https://www.musicpd.org/doc/html/user.html#client-hacks

Setting "mixer_type" to null would be one solution, but for calculating the correct master volume (for the external amplifier) the replay gain values have to be taken into account.

Since MPD already reads the replay gain values, why not just dump them in the "currentsong" command, and others can implement an external mixer (as obviously intended by MPD developers).
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: additional tags support (replay gain)

Post by max »

sf666 wrote: January 9th, 2020, 1:40 pm I'm actually not sure if MPD is able to fix it.
So you're not sure if the feature you want is really necessary. Not so convincing.

Let's assume the worst case: MPD is not able to fix your lack of satisfaction. Then what kind of magic fairy dust does your script have? How would your script fix your lack of satisfaction in a way unavailable to MPD?
sf666
Posts: 9
Joined: November 10th, 2018, 6:38 am

Re: additional tags support (replay gain)

Post by sf666 »

As I said, access to the master volume (of the external amplifier) is necessary but not available to MPD. In my setup (USB-DAC), MPD is only able to control the pre amplification level. This is the wrong point for applying replay gain in the signal flow. I would agree with your argumentation, if MPD controls directly the amplification (like the JACK output).

In detail:

MPD is only able to control the db pressure level in the range of silence (mpc volume 0) to the maximum of the amplifiers current master volume by setting "mpc volume 100". If, for example, the external amplifiers master volume is set to -20db, MPD is not able to raise the pressure level beyond this level, since it has no direct hardware access. This results in an unsatisfying listening experience. Therefore, the the volume control should be done by an external mixer, which is able to control the master volume using exact the same calculation logic as MPD does. Therefore the external mixer has to know the replay gain values for the current song.
sf666
Posts: 9
Joined: November 10th, 2018, 6:38 am

Re: additional tags support (replay gain)

Post by sf666 »

Hi,

may I interpret your silence as an approval of the original request?
Post Reply