# scaletempo

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.

## Example pipelines

     filesrc location=media.ext ! decodebin name=d \
         d. ! queue ! audioconvert ! audioresample ! scaletempo ! audioconvert ! audioresample ! autoaudiosink \
         d. ! queue ! videoconvert ! 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 (#GstScaletempo:stride) but consuming chunks proportional to the playback rate.

Scaletempo then smooths the output by blending the end of one stride with the next (#GstScaletempo: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. One can use the GstScaletempo:search propery to tune how far the algorithm looks.

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBaseTransform
                        ╰──scaletempo

## Factory details

Authors: – Rov Juvano

Classification: – `Filter/Effect/Rate/Audio`

Rank – none

Plugin – audiofx

Package – GStreamer Good Plug-ins

## Pad Templates

### `sink`

    audio/x-raw:
             format: F32LE
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             layout: interleaved
    audio/x-raw:
             format: F64LE
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             layout: interleaved
    audio/x-raw:
             format: S16LE
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             layout: interleaved

Presence – always

Direction – sink

Object type – GstPad

### `src`

    audio/x-raw:
             format: F32LE
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             layout: interleaved
    audio/x-raw:
             format: F64LE
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             layout: interleaved
    audio/x-raw:
             format: S16LE
               rate: [ 1, 2147483647 ]
           channels: [ 1, 2147483647 ]
             layout: interleaved

Presence – always

Direction – src

Object type – GstPad

## Properties

### overlap

    “overlap” gdouble

Percentage of stride to overlap

Flags : Read / Write

Default value : 0.2

### rate

    “rate” gdouble

Current playback rate

Flags : Read

Default value : 0

### search

    “search” guint

Length in milliseconds to search for best overlap position

Flags : Read / Write

Default value : 14

### stride

    “stride” guint

Length in milliseconds to output each stride

Flags : Read / Write

Default value : 30

The results of the search are