rgvolume

rgvolume — Apply ReplayGain volume adjustment

Synopsis

                    GstRgVolume;

Object Hierarchy

  GObject
   +----GstObject
         +----GstElement
               +----GstBin
                     +----GstRgVolume

Implemented Interfaces

GstRgVolume implements GstChildProxy.

Properties

  "album-mode"               gboolean              : Read / Write
  "fallback-gain"            gdouble               : Read / Write
  "headroom"                 gdouble               : Read / Write
  "pre-amp"                  gdouble               : Read / Write
  "result-gain"              gdouble               : Read
  "target-gain"              gdouble               : Read

Description

This element applies volume changes to streams as lined out in the proposed ReplayGain standard. It interprets the ReplayGain meta data tags and carries out the adjustment (by using a volume element internally). The relevant tags are:

  • GST_TAG_TRACK_GAIN
  • GST_TAG_TRACK_PEAK
  • GST_TAG_ALBUM_GAIN
  • GST_TAG_ALBUM_PEAK
  • GST_TAG_REFERENCE_LEVEL

The information carried by these tags must have been calculated beforehand by performing the ReplayGain analysis. This is implemented by the rganalysis element.

The signal compression/limiting recommendations outlined in the proposed standard are not implemented by this element. This has to be handled by separate elements because applications might want to have additional filters between the volume adjustment and the limiting stage. A basic limiter is included with this plugin: The rglimiter element applies -6 dB hard limiting as mentioned in the ReplayGain standard.

Example launch line

gst-launch filesrc location=filename.ext ! decodebin ! audioconvert \
    ! rgvolume ! audioconvert ! audioresample ! alsasink
Playback of a file

Details

GstRgVolume

typedef struct _GstRgVolume GstRgVolume;

Opaque data structure.

Property Details

The "album-mode" property

  "album-mode"               gboolean              : Read / Write

Whether to prefer album gain over track gain.

If set to TRUE, use album gain instead of track gain if both are available. This keeps the relative loudness levels of tracks from the same album intact.

If set to FALSE, track mode is used instead. This effectively leads to more extensive normalization.

If album mode is enabled but the album gain tag is absent in the stream, the track gain is used instead. If both gain tags are missing, the value of the fallback-gain property is used instead.

Default value: TRUE


The "fallback-gain" property

  "fallback-gain"            gdouble               : Read / Write

Fallback gain [dB] for streams missing ReplayGain tags.

Allowed values: [-60,60]

Default value: 0


The "headroom" property

  "headroom"                 gdouble               : Read / Write

Extra headroom [dB]. This controls the amount by which the output can exceed digital full scale.

Only set this to a value greater than 0.0 if signal compression/limiting of a suitable form is applied to the output (or output is brought into the correct range by some other transformation).

This element internally uses a volume element, which also supports operating on integer audio formats. These formats do not allow exceeding digital full scale. If extra headroom is used, make sure that the raw audio data format is floating point (audio/x-raw-float). Otherwise, clipping distortion might be introduced as part of the volume adjustment itself.

Allowed values: [0,60]

Default value: 0


The "pre-amp" property

  "pre-amp"                  gdouble               : Read / Write

Additional gain to apply globally [dB]. This controls the trade-off between uniformity of normalization and utilization of available dynamic range.

Note that the default value is 0 dB because the ReplayGain reference value was adjusted by +6 dB (from 83 to 89 dB). At the time of this writing, the webpage is still outdated and does not reflect this change however. Where the original proposal states that a proper default pre-amp value is +6 dB, this translates to the used 0 dB.

Allowed values: [-60,60]

Default value: 0


The "result-gain" property

  "result-gain"              gdouble               : Read

Applied gain [dB]. This gain is applied to processed buffer data.

This is set to the target gain if amplification by that amount can be applied safely. "Safely" means that the volume adjustment does not inflict clipping distortion. Should this not be the case, the result gain is set to an appropriately reduced value (by applying peak normalization). The proposed standard calls this "clipping prevention".

The difference between target and result gain reflects the necessary amount of reduction. Applications can make use of this information to temporarily reduce the pre-amp for subsequent streams, as recommended by the ReplayGain standard.

Note that target and result gain differing for a great majority of streams indicates a problem: What happens in this case is that most streams receive peak normalization instead of amplification by the ideal replay gain. To prevent this, the pre-amp has to be lowered and/or a limiter has to be used which facilitates the use of headroom.

Allowed values: [-120,120]

Default value: 0


The "target-gain" property

  "target-gain"              gdouble               : Read

Applicable gain [dB]. This gain is supposed to be applied.

Depending on the value of the album-mode property and the presence of ReplayGain tags in the stream, this is set according to one of these simple formulas:

Allowed values: [-120,120]

Default value: 0

See Also

GstRgLimiter, GstRgAnalysis