## audioconvert audioconvert |

## Properties

GstAudioDitherMethod | dithering | Read / Write
GstAudioNoiseShapingMethod | noise-shaping | Read / Write
GstValueArray | mix-matrix | Read / Write

## Types and Values

struct | GstAudioConvert

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBaseTransform
                        ╰── GstAudioConvert

## Description

Audioconvert converts raw audio buffers between various possible formats. It supports integer to float conversion, width/depth conversion, signedness and endianness conversion and channel transformations (ie. upmixing and downmixing), as well as dithering and noise-shaping.

#### Example launch line

    1
    gst-launch-1.0 -v -m audiotestsrc ! audioconvert ! audio/x-raw,format=S8,channels=2 ! level ! fakesink silent=TRUE

This pipeline converts audio to 8-bit. The level element shows that the output levels still match the one for a sine wave.

    1
    gst-launch-1.0 -v -m uridecodebin uri=file:///path/to/audio.flac ! audioconvert ! vorbisenc ! oggmux ! filesink location=audio.ogg

The vorbis encoder takes float audio data instead of the integer data output by most other audio elements. This pipeline decodes a FLAC audio file (or any other audio file for which decoders are installed) and re-encodes it into an Ogg/Vorbis audio file.

A mix matrix can be passed to audioconvert, that will govern the remapping of input to output channels.

#### Example matrix generation code

To generate the matrix using code:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    GValue v = G_VALUE_INIT;
    GValue v2 = G_VALUE_INIT;
    GValue v3 = G_VALUE_INIT;

    g_value_init (&v2, GST_TYPE_ARRAY);
    g_value_init (&v3, G_TYPE_FLOAT);
    g_value_set_float (&v3, 1);
    gst_value_array_append_value (&v2, &v3);
    g_value_unset (&v3);
    [ Repeat for as many float as your input channels - unset and reinit v3 ]
    g_value_init (&v, GST_TYPE_ARRAY);
    gst_value_array_append_value (&v, &v2);
    g_value_unset (&v2);
    [ Repeat for as many v2's as your output channels - unset and reinit v2]
    g_object_set_property (G_OBJECT (audioconvert), "mix-matrix", &v);
    g_value_unset (&v);

#### Example launch line

    1
    gst-launch-1.0 audiotestsrc ! audio/x-raw, channels=4 ! audioconvert mix-matrix="<<(float)1.0, (float)0.0, (float)0.0, (float)0.0>, <(float)0.0, (float)1.0, (float)0.0, (float)0.0>>" ! audio/x-raw,channels=2 ! autoaudiosink

> If an empty mix matrix is specified, a (potentially truncated) identity matrix will be generated.

#### Example empty matrix generation code

    1
    2
    3
    4
    5
    GValue v = G_VALUE_INIT;

    g_value_init (&v, GST_TYPE_ARRAY);
    g_object_set_property (G_OBJECT (audioconvert), "mix-matrix", &v);
    g_value_unset (&v);

#### Example empty matrix launch line

    1
    gst-launch-1.0 -v audiotestsrc ! audio/x-raw,channels=8 ! audioconvert mix-matrix="<>" ! audio/x-raw,channels=16,channel-mask=\(bitmask\)0x0000000000000000 ! fakesink

## Synopsis

### Element Information

plugin | audioconvert
author | Benjamin Otte <otte@gnome.org>
class | Filter/Converter/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 GstAudioConvert

    struct GstAudioConvert;

The audioconvert object structure.

## Property Details

### The `“dithering”` property

      “dithering”                GstAudioDitherMethod

Selects between different dithering methods.

Flags: Read / Write

Default value: GST_AUDIO_DITHER_TPDF

### The `“noise-shaping”` property

      “noise-shaping”            GstAudioNoiseShapingMethod

Selects between different noise shaping methods.

Flags: Read / Write

Default value: GST_AUDIO_NOISE_SHAPING_NONE

### The `“mix-matrix”` property

      “mix-matrix”               GstValueArray

Transformation matrix for input/output channels.

Flags: Read / Write