rgvolume

rgvolume — Apply ReplayGain volume adjustment

Properties

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

Types and Values

struct GstRgVolume

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GstObject
            ╰── GstElement
                ╰── GstBin
                    ╰── GstRgVolume

Implemented Interfaces

GstRgVolume implements GstChildProxy.

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:

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

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

Synopsis

Element Information

plugin

replaygain

author

René Stadler <mail@renestadler.de>

class

Filter/Effect/Audio

Element Pads

name

sink

direction

sink

presence

always

details

audio/x-raw, format=(string){ F32LE, S16LE }, layout=(string){ interleaved, non-interleaved }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

name

src

direction

source

presence

always

details

audio/x-raw, format=(string){ F32LE, S16LE }, layout=(string){ interleaved, non-interleaved }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

Functions

Types and Values

struct GstRgVolume

struct GstRgVolume;

Opaque data structure.

Property Details

The “album-mode” property

  “album-mode”               gboolean

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.

Flags: Read / Write

Default value: TRUE


The “fallback-gain” property

  “fallback-gain”            gdouble

Fallback gain [dB] for streams missing ReplayGain tags.

Flags: Read / Write

Allowed values: [-60,60]

Default value: 0


The “headroom” property

  “headroom”                 gdouble

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 (F32). Otherwise, clipping distortion might be introduced as part of the volume adjustment itself.

Flags: Read / Write

Allowed values: [0,60]

Default value: 0


The “pre-amp” property

  “pre-amp”                  gdouble

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.

Flags: Read / Write

Allowed values: [-60,60]

Default value: 0


The “result-gain” property

  “result-gain”              gdouble

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”.

Flags: Read

Allowed values: [-120,120]

Default value: 0


The “target-gain” property

  “target-gain”              gdouble

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:

Flags: Read

Allowed values: [-120,120]

Default value: 0

See Also

GstRgLimiter, GstRgAnalysis