# rgvolume

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-1.0 filesrc location=filename.ext ! decodebin ! audioconvert \
         ! rgvolume ! audioconvert ! audioresample ! alsasink

Playback of a file

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBin
                        ╰──rgvolume

## Implemented interfaces

    GstChildProxy

## Factory details

Authors: – René Stadler <mail></mail>

Classification: – `Filter/Effect/Audio`

Rank – none

Plugin – replaygain

Package – GStreamer Good Plug-ins

## Pad Templates

### `sink`

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

Presence – always

Direction – sink

Object type – GstPad

### `src`

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

Presence – always

Direction – src

Object type – GstPad

## Properties

### album-mode

    “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

### fallback-gain

    “fallback-gain” gdouble

Fallback gain [dB] for streams missing ReplayGain tags.

Flags : Read / Write

Default value : 0

### headroom

    “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

Default value : 0

### pre-amp

    “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). The original proposal stated that a proper default pre-amp value is +6 dB, this translates to the used 0 dB.

Flags : Read / Write

Default value : 0

### result-gain

    “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

Default value : 0

### target-gain

    “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:

- pre-amp + album gain of the stream
- pre-amp + track gain of the stream
- pre-amp + fallback-gain

Flags : Read

Default value : 0

The results of the search are