# audioresample

audioresample resamples raw audio buffers to different sample rates using a configurable windowing function to enhance quality.

By default, the resampler uses a reduced sinc table, with cubic interpolation filling in the gaps. This ensures that the table does not become too big. However, the interpolation increases the CPU usage considerably. As an alternative, a full sinc table can be used. Doing so can drastically reduce CPU usage (4x faster with 44.1 -> 48 kHz conversions for example), at the cost of increased memory consumption, plus the sinc table takes longer to initialize when the element is created. A third mode exists, which uses the full table unless said table would become too large, in which case the interpolated one is used instead.

## Example launch line

     gst-launch-1.0 -v uridecodebin uri=file:///path/to/audio.ogg ! audioconvert ! audioresample ! audio/x-raw, rate=8000 ! autoaudiosink

Decode an audio file and downsample it to 8Khz and play sound. To create the Ogg/Vorbis file refer to the documentation of vorbisenc. This assumes there is an audio sink that will accept/handle 8kHz audio.

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBaseTransform
                        ╰──audioresample

## Factory details

Authors: – Sebastian Dröge

Classification: – `Filter/Converter/Audio`

Rank – primary

Plugin – audioresample

Package – GStreamer Base Plug-ins

## Pad Templates

### `sink`

    audio/x-raw:
             format: { F64LE, F64BE, F32LE, F32BE, S32LE, S32BE, U32LE, U32BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S24LE, S24BE, U24LE, U24BE, S20_32LE, S20_32BE, U20_32LE, U20_32BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, S16LE, S16BE, U16LE, U16BE, S8, U8 }
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             layout: { (string)interleaved, (string)non-interleaved }

Presence – always

Direction – sink

Object type – GstPad

### `src`

    audio/x-raw:
             format: { F64LE, F64BE, F32LE, F32BE, S32LE, S32BE, U32LE, U32BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S24LE, S24BE, U24LE, U24BE, S20_32LE, S20_32BE, U20_32LE, U20_32BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, S16LE, S16BE, U16LE, U16BE, S8, U8 }
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             layout: { (string)interleaved, (string)non-interleaved }

Presence – always

Direction – src

Object type – GstPad

## Properties

### quality

    “quality” gint

Resample quality with 0 being the lowest and 10 being the best

Flags : Read / Write / Construct

Default value : 4

### resample-method

    “resample-method” GstAudioResamplerMethod *

What resample method to use

Flags : Read / Write

Default value : kaiser (4)

### sinc-filter-auto-threshold

    “sinc-filter-auto-threshold” guint

Memory usage threshold to use if sinc filter mode is AUTO, given in bytes

Flags : Read / Write

Default value : 1048576

### sinc-filter-interpolation

    “sinc-filter-interpolation” GstAudioResamplerFilterInterpolation *

How to interpolate the sinc filter table

Flags : Read / Write

Default value : cubic (2)

### sinc-filter-mode

    “sinc-filter-mode” GstAudioResamplerFilterMode *

What sinc filter table mode to use

Flags : Read / Write

Default value : auto (2)

## Named constants

### Audio-resampler-filter-interpolation

#### Members

`none` (0) – GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_NONE
`linear` (1) – GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_LINEAR
`cubic` (2) – GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC

### Audio-resampler-filter-mode

#### Members

`interpolated` (0) – GST_AUDIO_RESAMPLER_FILTER_MODE_INTERPOLATED
`full` (1) – GST_AUDIO_RESAMPLER_FILTER_MODE_FULL
`auto` (2) – GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO

### Audio-resampler-method

#### Members

`nearest` (0) – GST_AUDIO_RESAMPLER_METHOD_NEAREST
`linear` (1) – GST_AUDIO_RESAMPLER_METHOD_LINEAR
`cubic` (2) – GST_AUDIO_RESAMPLER_METHOD_CUBIC
`blackman-nuttall` (3) – GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL
`kaiser` (4) – GST_AUDIO_RESAMPLER_METHOD_KAISER

The results of the search are