AudioPitchShift

AudioPitchShift[audio,r]

applies pitch shifting to audio by the ratio r, shifting every frequency to .

Details and Options

  • AudioPitchShift shifts the pitch of the input audio signal without affecting the duration.
  • The frequency ratio r can be given as a pitch interval, including:
  • Quantity[oct,"octaves"]correspond to
    Quantity[sem,"semitones"]correspond to
  • AudioPitchShift takes a PartitionGranularity option that controls the partitioning of audio, used for the computation of the short-time Fourier transform.
  • By default, a phase vocoder algorithm is used. Select Method->"Speech" to use an algorithm tailored for speech signals. In this case, while the fundamental frequency is changed, the formants of the signal are not modified.

Examples

open allclose all

Basic Examples  (2)

Shift the audio pitch by a factor of two:

Shift the audio pitch by a semitone:

Scope  (3)

A shift by n octaves corresponds to a frequency ratio of 2n:

A shift by s semitones corresponds to a frequency ratio of 2s/12:

AudioPitchShift can be used to change the pitch of a harmonically complex sound without altering its timbre and timing:

The frequency ratio between the components of the audio signal is not changed:

Options  (4)

Method  (1)

Use Method->"Speech" for speech signals to shift the pitch while maintaining other voice characteristics:

Compare with the normal pitch shifting, which dramatically affects the timbre of the voice:

PartitionGranularity  (3)

Using a bigger partition size will improve the frequency response but will smear the transient components:

Using a small offset value will in general increase the quality of the result at the cost of more computation time:

If only the partition size is specified, the offset is calculated as 25% of the partition size.

Use a different window shape to change the quality of the result:

By default, HannWindow is used.

Applications  (1)

Shift the pitch of an audio object to match a target frequency:

Extract the mean frequency with AudioLocalMeasurements:

Shift the audio to reach the target frequency:

Properties & Relations  (2)

AudioPitchShift and AudioFrequencyShift modify the spectrum of the signal in different ways:

AudioPitchShift shifts each frequency f in the signal by an amount proportional to the frequency itself (f'=f×shift), thus preserving the timbre in the shifted signal:

AudioFrequencyShift shifts every frequency f by the same amount (f'=f+shift), changing dramatically the timbre in the shifted signal:

Change the pitch of a recording by using a different sample rate:

AudioPitchShift changes the pitch without altering the timing:

Possible Issues  (2)

The quality of the result degrades with large shift parameters:

Using Method->"Speech" for non-speech signals may not sound as expected:

Introduced in 2016
 (11.0)
 |
Updated in 2020
 (12.1)