Time Pitch Algorithm Settings

The constants define the values for the time pitch algorithms.

Overview

In macOS, the default algorithm for all time pitch operations is spectral.

On iOS, the default algorithm for playback is lowQualityZeroLatency and the default for export & other offline processing is spectral.

For scaled audio edits, i.e. when the timeMapping of an AVAssetTrackSegment is between timeRanges of unequal duration, it is important to choose an algorithm that supports the full range of edit rates present in the source media. spectral is often the best choice due to the highly inclusive range of rates it supports, assuming that it is desirable to maintain a constant pitch regardless of the edit rate. If it is instead desirable to allow the pitch to vary with the edit rate, varispeed is the best choice.

Topics

Constants

static let lowQualityZeroLatency: AVAudioTimePitchAlgorithm

Low quality and very low computationally intensive pitch algorithm. Suitable for brief fast-forward and rewind effects as well as low quality voice. The rate is snapped to {0.5, 0.666667, 0.8, 1.0, 1.25, 1.5, 2.0}.

static let timeDomain: AVAudioTimePitchAlgorithm

Modest quality pitch algorithm that is less computationally intensive. Suitable for voice. Variable rate from 1/32 to 32.

static let spectral: AVAudioTimePitchAlgorithm

Highest quality, most computationally expensive. Suitable for music. Variable rate from 1/32 to 32.

static let varispeed: AVAudioTimePitchAlgorithm

High quality, no pitch correction. Pitch varies with rate. Variable rate from 1/32 to 32.

See Also

Audio Settings

Sample Rate Conversion Settings

Sample rate converter audio quality settings.

AVChannelLayoutKey

Key to retrieve channel layout information for playback.

enum AVAudioQuality

Keys that specify sample rate conversion quality, used for the AVSampleRateConverterAlgorithmKey property.