scaletempo

scaletempo — Sync audio tempo with playback rate

Synopsis

                    GstScaletempo;

Object Hierarchy

  GObject
   +----GstObject
         +----GstElement
               +----GstBaseTransform
                     +----GstScaletempo

Properties

  "overlap"                  gdouble               : Read / Write
  "rate"                     gdouble               : Read
  "search"                   guint                 : Read / Write
  "stride"                   guint                 : Read / Write

Description

Example pipelines

Scale tempo while maintaining pitch (WSOLA-like technique with cross correlation) Inspired by SoundTouch library by Olli Parviainen

Use Sceletempo to apply playback rates without the chipmunk effect.

filesrc location=media.ext ! decodebin name=d \
    d. ! queue ! audioconvert ! audioresample ! scaletempo ! audioconvert ! audioresample ! autoaudiosink \
    d. ! queue ! ffmpegcolorspace ! autovideosink

OR

playbin uri=... audio_sink="scaletempo ! audioconvert ! audioresample ! autoaudiosink"

When an application sends a seek event with rate != 1.0, Scaletempo applies the rate change by scaling the tempo without scaling the pitch.

Scaletempo works by producing audio in constant sized chunks (a "stride") but consuming chunks proportional to the playback rate.

Scaletempo then smooths the output by blending the end of one stride with the next ("overlap").

Scaletempo smooths the overlap further by searching within the input buffer for the best overlap position. Scaletempo uses a statistical cross correlation (roughly a dot-product). Scaletempo consumes most of its CPU cycles here.

Details

GstScaletempo

typedef struct _GstScaletempo GstScaletempo;

Property Details

The "overlap" property

  "overlap"                  gdouble               : Read / Write

Percentage of stride to overlap.

Allowed values: [0,1]

Default value: 0.2


The "rate" property

  "rate"                     gdouble               : Read

Current playback rate.

Allowed values: [-2.14748e+09,2.14748e+09]

Default value: 1


The "search" property

  "search"                   guint                 : Read / Write

Length in milliseconds to search for best overlap position.

Allowed values: <= 500

Default value: 14


The "stride" property

  "stride"                   guint                 : Read / Write

Length in milliseconds to output each stride.

Allowed values: [1,5000]

Default value: 30