Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPD ignores opus header gain even with ReplayGain enabled #957

Closed
awused opened this issue Sep 18, 2020 · 2 comments
Closed

MPD ignores opus header gain even with ReplayGain enabled #957

awused opened this issue Sep 18, 2020 · 2 comments
Labels
unsupported Affects an unsupported old MPD version.

Comments

@awused
Copy link
Contributor

awused commented Sep 18, 2020

Bug report

Describe the bug

Right now MPD only applies the r128_track_gain or r128_album_gain from opus files and ignores the output gain field in the header. The contents of the output gain header are not always consistent between different tools I've used to apply tags. Some use it for track gain and store the album gain as a difference in r128_album_gain with r128_track_gain set to 0 and some set output gain to 0 and only use the r128 tags, but in every case adding the appropriate r128 gain to the output gain gives the correct gain.

Per the Opus Spec (https://tools.ietf.org/html/rfc7845#section-5.1):
Players and media frameworks SHOULD apply it by default. If a player chooses to apply any volume adjustment or gain modification, such as the R128_TRACK_GAIN (see Section 5.2), the adjustment MUST be applied in addition to this output gain in order to achieve playback at the normalized volume.

There's a further complication in that ReplayGain uses a reference volume of 89dBFS but EBU R128 specifies -23 LUFS. ReplayGain scanners typically write tags to match ReplayGain's levels even when using EBU R128 for determining loudness, except in the case of Opus where every tagging program I've used writes gain for -23 LUFS per the spec. Other music players apply a +5dB correction to get playback to the same level.

Expected Behavior

The gain with ReplayGain enabled is r128_track/album_gain + output gain + 5dB. Output volume is consistent with other formats in MPD and other programs, even when using tagging programs (loudness-scanner, deadbeef, foobar, r128gain) with different behaviour.

Actual Behavior

Only r128_track_gain or r128_album_gain is applied. This results in inconsistent playback volume that varies depending on the program used to tag the file.

Version

Music Player Daemon 0.21.25 (0.21.25)
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 upnp

Storage plugins:
local smbclient udisks nfs curl

Neighbor plugins:
smbclient upnp udisks

Decoders plugins:
[mad] mp3 mp2
[mpg123] mp3
[vorbis] ogg oga
[oggflac] ogg oga
[flac] flac
[opus] opus ogg oga
[sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
[audiofile] wav au aiff aif
[dsdiff] dff
[dsf] dsf
[hybrid_dsd] m4a
[faad] aac
[wavpack] wv
[modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm
[mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm
[sidplay] sid mus str prg P00
[wildmidi] mid
[fluidsynth] mid
[adplug] amd d00 hsc laa rad raw sa2
[ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t 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 omg 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 wav webm wma wmv wsaud wsvga wv wve
[pcm]

Filters:
libsamplerate soxr

Tag plugins:
id3tag

Output plugins:
shout null fifo pipe alsa ao oss openal pulse jack httpd recorder

Encoder plugins:
null vorbis opus lame twolame wave flac

Archive plugins:
[bz2] bz2
[zzip] zip
[iso] iso

Input plugins:
file archive alsa tidal qobuz curl ffmpeg smbclient nfs mms cdio_paranoia

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

Protocols:
file:// alsa:// tidal:// qobuz:// http:// https:// gopher:// rtp:// rtsp:// rtmp:// rtmpt:// rtmps:// smb:// nfs:// mms:// mmsh:// mmst:// mmsu:// cdda://

Other features:
avahi dbus udisks epoll icu inotify ipv6 systemd tcp un

Log

@MaxKellermann
Copy link
Member

You were asked to provide the MPD version number, but you decided not to tell.

@MaxKellermann MaxKellermann added the unsupported Affects an unsupported old MPD version. label Sep 18, 2020
@MaxKellermann
Copy link
Member

23d5a2b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unsupported Affects an unsupported old MPD version.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants