Subject: Re: [codec] draft-ietf-codec-oggopus-01

From: Calvin Walton <[email-masked]>
Date: Tue, 04 Jun 2013 14:56:54 -0400

On Fri, 2013-05-24 at 23:45 +0800, Ralph Giles wrote:
> I've updated the Ogg Opus encapsulation draft.
> 
> https://tools.ietf.org/html/draft-ietf-codec-oggopus-01

Hi,

I note that the specification still has some wording regarding the gain
header fields that I hope could be clarified.

>    To avoid confusion with multiple normalization schemes, an Opus
>    comment header SHOULD NOT contain any of the REPLAYGAIN_TRACK_GAIN,
>    REPLAYGAIN_TRACK_PEAK, REPLAYGAIN_ALBUM_GAIN, or
>    REPLAYGAIN_ALBUM_PEAK tags.
> 
>    There is no Opus comment tag corresponding to REPLAYGAIN_ALBUM_GAIN.
>    That information should instead be stored in the ID header's 'output
>    gain' field.

My concern is regarding the note about the album gain.

>From previous discussion, my impression is that the ID header's "output
gain" is supposed to have no semantic meaning, other than that it is the
preferred playback volume offset as set by the last person to edit the
file metadata.

Unfortunately, existing players (some versions of foobar2000, although I
haven't tested the latest) have taken the wording of this section to
mean that the value in the ID header field can be interpreted as per the
EBU-R128 specification, and be used for volume normalization relative to
the R128 reference level.

This means that if I e.g. put a value such that a track will be the same
volume level as my (89 dB SPL-reference) ReplayGained vorbis files, then
foobar2000 will reinterpret it, and play the file at a different volume
than I desired! (Roughly ~3dB offset.)

Other players (e.g. rockbox and gstreamer-based players) will use the ID
header value as-is, and apply no other correction.

At this point, I'm not sure what my recommendation would be, but I hope
the wording in this section can be clarified somewhat to indicate that
the player cannot assume that the value in the ID header gain field
cannot be interpreted as having any particular semantic meaning - and
should be simply applied as-is.

-- 
Calvin Walton <[email-masked]>

---

From: Ralph Giles <[email-masked]>
Date: Tue, 04 Jun 2013 15:27:15 -0700

> the R128 reference level.

I can see how the spec could be read that way. The output gain from the
ID header is combined with, and described as shifting values between,
the R128_TRACK_GAIN tag.

> than I desired! (Roughly ~3dB offset.)

What do you mean by 'the same volume level' here? Surely if both files
are have gains recorded relative to their respective normalization
algorithms, they should play with the same level?

> header value as-is, and apply no other correction.

And instead, players which don't do any special replaygain handling are
should play the files at different levels. I.e. the point of the
R128_TRACK_GAIN tag was to encourage players to move to R128; foobar has
done so, and the other players you mention have not.

> should be simply applied as-is.

I agree these sections are very confusing, and would like to clear it
up. I don't think what you say is true here, because of the way the spec
conflates album gain and the output gain header.

The spec suggests scaling the audio before encoding, so no gain is
necessary. If that's not feasible (e.g. you want to maintain the
original amplitude for later burning to CD, or someone else encoded the
file wrong) you can fix the overall playback level with the output gain
field in the ID header. This adjustment is always applied and should
therefore be relative to some fixed reference.

If you further want to adjust the playback gain relative to that level,
use the R128_TRACK_GAIN comment.

This is why the spec says to merge 'album' gain into the output gain
field: album-wide normalization is likely to set to overall signal level
relative to a fixed reference, so it's very similar to fixing the same
problem the gain header addresses.

So, how can we make that intention more clear?

 -r