audioresample

audioresample

Properties

gint quality Read / Write / Construct
guint sinc-filter-auto-threshold Read / Write
SpeexResamplerSincFilterMode sinc-filter-mode Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GstObject
            ╰── GstElement
                ╰── GstBaseTransform
                    ╰── GstAudioResample

Description

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

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

Synopsis

Element Information

plugin

audioresample

author

Sebastian Dröge <sebastian.droege@collabora.co.uk>

class

Filter/Converter/Audio

Element Pads

name

sink

direction

sink

presence

always

details

audio/x-raw, format=(string){ F32LE, F64LE, S32LE, S24LE, S16LE, S8 }, 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){ F32LE, F64LE, S32LE, S24LE, S16LE, S8 }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string){ interleaved, non-interleaved }

Functions

Types and Values

struct GstAudioResample

struct GstAudioResample;

Opaque data structure.

Property Details

The “quality” property

  “quality”                  gint

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

Flags: Read / Write / Construct

Allowed values: [0,10]

Default value: 4


The “sinc-filter-auto-threshold” property

  “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


The “sinc-filter-mode” property

  “sinc-filter-mode”         SpeexResamplerSincFilterMode

What sinc filter table mode to use.

Flags: Read / Write

Default value: Use full table if table size below threshold