Subject: [codec] draft-ietf-codec-oggopus and "album" gain

From: Gregory Maxwell <[email-masked]>
Date: Mon, 4 Aug 2014 11:06:35 -0700

There have been a comments from a number of implementers that their
applications would like to know if "album" gain adjustment had been
performed on a track. An album gain is a feature the replaygain
tagging has which allowed the dynamics within a collection of tracks
to be preserved while still normalizing the collection overall.

Right now, the draft just recommends the encoder store it in the
header gain field— which works okay but doesn't allow a player to know
for sure which gain is being applied.

To clear this up I'm proposing we add a R128_ALBUM_GAIN which works
just like R128_TRACK_GAIN and which can be set to zero when the header
gain matches the album gain.

Here is a diff against the current draft:

diff --git a/doc/draft-ietf-codec-oggopus.xml b/doc/draft-ietf-codec-oggopus.xml
index cb1f739..9364361 100644
--- a/doc/draft-ietf-codec-oggopus.xml
+++ b/doc/draft-ietf-codec-oggopus.xml
@@ -1155,7 +1155,7 @@ The user comment strings follow the NAME=value
format described by
  <xref target="vorbis-comment"/> with the same recommended tag names.
 </t>
 <figure align="center">
-  <preamble>One new comment tag is introduced for Ogg Opus:</preamble>
+  <preamble>Two new comment tags are introduced for Ogg Opus:</preamble>
 <artwork align="left"><![CDATA[
 R128_TRACK_GAIN=-573
 ]]></artwork>
@@ -1170,32 +1170,38 @@ This tag is similar to the REPLAYGAIN_TRACK_GAIN tag in
  Vorbis&nbsp;<xref target="replay-gain"/>, except that the normal volume
  reference is the <xref target="EBU-R128"/> standard.
 </t>
+<artwork align="left"><![CDATA[
+R128_ALBUM_GAIN=111
+]]></artwork>
+<postamble>
+representing the volume shift needed to normalize the volume of a collection
+ of tracks.
+The gain is a Q7.8 fixed point number in dB, as in the ID header's 'output
+ gain' field.
+</postamble>
+</figure>
 <t>
-An Ogg Opus file MUST NOT have more than one such tag, and if present its
- value MUST be an integer from -32768 to 32767, inclusive, represented in
+An Ogg Opus file MUST NOT have more than one of each tags, and if present
+ their values MUST be an integer from -32768 to 32767, inclusive,
represented in
  ASCII with no whitespace.
-If present, it MUST correctly represent the R128 normalization gain relative
- to the 'output gain' field specified in the ID header.
-If a player chooses to make use of the R128_TRACK_GAIN tag, it MUST be
- applied <spanx style="emph">in addition</spanx> to the 'output gain' value.
+If present, REPLAYGAIN_TRACK_GAIN MUST correctly represent the R128
+ normalization gain relative to the 'output gain' field specified in
the ID header.
+If a player chooses to make use of the R128_TRACK_GAIN tag or the
+ R128_ALBUM_GAIN, it MUST be applied <spanx style="emph">in addition</spanx> to
[gmaxwell@helmholtz doc]$ git diff | cat
diff --git a/doc/draft-ietf-codec-oggopus.xml b/doc/draft-ietf-codec-oggopus.xml
index cb1f739..9364361 100644
--- a/doc/draft-ietf-codec-oggopus.xml
+++ b/doc/draft-ietf-codec-oggopus.xml
@@ -1155,7 +1155,7 @@ The user comment strings follow the NAME=value
format described by
  <xref target="vorbis-comment"/> with the same recommended tag names.
 </t>
 <figure align="center">
-  <preamble>One new comment tag is introduced for Ogg Opus:</preamble>
+  <preamble>Two new comment tags are introduced for Ogg Opus:</preamble>
 <artwork align="left"><![CDATA[
 R128_TRACK_GAIN=-573
 ]]></artwork>
@@ -1170,32 +1170,38 @@ This tag is similar to the REPLAYGAIN_TRACK_GAIN tag in
  Vorbis&nbsp;<xref target="replay-gain"/>, except that the normal volume
  reference is the <xref target="EBU-R128"/> standard.
 </t>
+<artwork align="left"><![CDATA[
+R128_ALBUM_GAIN=111
+]]></artwork>
+<postamble>
+representing the volume shift needed to normalize the volume of a collection
+ of tracks.
+The gain is a Q7.8 fixed point number in dB, as in the ID header's 'output
+ gain' field.
+</postamble>
+</figure>
 <t>
-An Ogg Opus file MUST NOT have more than one such tag, and if present its
- value MUST be an integer from -32768 to 32767, inclusive, represented in
+An Ogg Opus file MUST NOT have more than one of each tags, and if present
+ their values MUST be an integer from -32768 to 32767, inclusive,
represented in
  ASCII with no whitespace.
-If present, it MUST correctly represent the R128 normalization gain relative
- to the 'output gain' field specified in the ID header.
-If a player chooses to make use of the R128_TRACK_GAIN tag, it MUST be
- applied <spanx style="emph">in addition</spanx> to the 'output gain' value.
+If present, REPLAYGAIN_TRACK_GAIN MUST correctly represent the R128
+ normalization gain relative to the 'output gain' field specified in
the ID header.
+If a player chooses to make use of the R128_TRACK_GAIN tag or the
+ R128_ALBUM_GAIN, it MUST be applied <spanx style="emph">in addition</spanx> to
+ the 'output gain' value.
 If an encoder wishes to use R128 normalization, and the output gain is not
  otherwise constrained or specified, the encoder SHOULD write the R128 gain
  into the 'output gain' field and store a tag containing "R128_TRACK_GAIN=0".
 That is, it should assume that by default tools will respect the 'output gain'
  field, and not the comment tag.
 If a tool modifies the ID header's 'output gain' field, it MUST also update or
- remove the R128_TRACK_GAIN comment tag.
+ remove the R128_TRACK_GAIN and R128_ALBUM_GAIN comment tags.
 </t>
 <t>
 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.
 </t>
-<t>
-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.
-</t>
 </section>

 </section>

---

From: Calvin Walton <[email-masked]>
Date: Mon, 04 Aug 2014 13:40:00 -0500

Hi, I noticed a typo in the diff; see the inline note below.

Note that I'm still of the opinion that there should not be any language
in the spec that explicitly disallows use of the REPLAYGAIN_*_GAIN tags
as implemented in Vorbis; the use of these tags in Ogg Opus is already
interoperable with many applications including Rockbox, GStreamer-based
players like Rhythmbox, and foobar2000 (when added manually via an
external tool).

Perhaps there should be something that states that if both R128_*_GAIN
and REPLAYGAIN_*_GAIN tags are present, the application should use
either one set or the other, but not attempt to apply both.

> Here is a diff against the current draft:

[...]

> +If present, REPLAYGAIN_TRACK_GAIN MUST correctly represent the R128

This should be "R128_TRACK_GAIN"

> _______________________________________________
> codec mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/codec

-- 
Calvin Walton <[email-masked]>

---

From: Ralph Giles <[email-masked]>
Date: Fri, 08 Aug 2014 14:36:20 -0700

> gain matches the album gain.

Thanks for the patch. I agree, this is a useful response to the feedback
we've received. Applied with fixes.

 -r