## audiorate audiorate — Drops/duplicates/adjusts timestamps on audio samples to make a perfect stream |

## Properties

guint64 | add | Read
guint64 | drop | Read
guint64 | in | Read
guint64 | out | Read
gboolean | silent | Read / Write
gboolean | skip-to-first | Read / Write
guint64 | tolerance | Read / Write

## Types and Values

struct | GstAudioRate

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstAudioRate

## Description

This element takes an incoming stream of timestamped raw audio frames and produces a perfect stream by inserting or dropping samples as needed.

This operation may be of use to link to elements that require or otherwise implicitly assume a perfect stream as they do not store timestamps, but derive this by some means (e.g. bitrate for some AVI cases).

The properties “in”, “out”, “add” and “drop” can be read to obtain information about number of input samples, output samples, dropped samples (i.e. the number of unused input samples) and inserted samples (i.e. the number of samples added to stream).

When the “silent” property is set to FALSE, a GObject property notification will be emitted whenever one of the “add” or “drop” values changes. This can potentially cause performance degradation. Note that property notification will happen from the streaming thread, so applications should be prepared for this.

If the “tolerance” property is non-zero, and an incoming buffer's timestamp deviates less than the property indicates from what would make a 'perfect time', then no samples will be added or dropped. Note that the output is still guaranteed to be a perfect stream, which means that the incoming data is then simply shifted (by less than the indicated tolerance) to a perfect time.

### Example pipelines

    1
    gst-launch -v alsasrc ! audiorate ! wavenc ! filesink location=alsa.wav

Capture audio from an ALSA device, and turn it into a perfect stream for saving in a raw audio file.

## Synopsis

### Element Information

plugin | audiorate
author | Wim Taymans <wim@fluendo.com>
class | Filter/Effect/Audio

### Element Pads

name | sink
direction | sink
presence | always
details | audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string){ interleaved, non-interleaved }

name | src
direction | source
presence | always
details | audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string){ interleaved, non-interleaved }

## Functions

## Types and Values

### struct GstAudioRate

    struct GstAudioRate;

Opaque data structure.

## Property Details

### The `“add”` property

      “add”                      guint64

Number of added samples.

Flags: Read

Default value: 0

### The `“drop”` property

      “drop”                     guint64

Number of dropped samples.

Flags: Read

Default value: 0

### The `“in”` property

      “in”                       guint64

Number of input samples.

Flags: Read

Default value: 0

### The `“out”` property

      “out”                      guint64

Number of output samples.

Flags: Read

Default value: 0

### The `“silent”` property

      “silent”                   gboolean

Don't emit notify for dropped and duplicated frames.

Flags: Read / Write

Default value: TRUE

### The `“skip-to-first”` property

      “skip-to-first”            gboolean

Don't produce buffers before the first one we receive.

Flags: Read / Write

Default value: FALSE

### The `“tolerance”` property

      “tolerance”                guint64

The difference between incoming timestamp and next timestamp must exceed the given value for audiorate to add or drop samples.

Flags: Read / Write

Default value: 40000000

## See Also

GstVideoRate