AudioPitchShift

AudioPitchShift[audio,r]

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

AudioPitchShift[video,r]

applies pitch shifting to the first audio track in video.

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
• The following options are supported:
•  Method Automatic the method to use PartitionGranularity Automatic control the partitioning used for the computation of the short-time Fourier transform
• By default, a phase vocoder algorithm is used. Use Method->"Speech" for pitch shifting 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(4)

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:

Process the audio track of a video:

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:

Wolfram Research (2016), AudioPitchShift, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioPitchShift.html (updated 2024).

Text

Wolfram Research (2016), AudioPitchShift, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioPitchShift.html (updated 2024).

CMS

Wolfram Language. 2016. "AudioPitchShift." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/AudioPitchShift.html.

APA

Wolfram Language. (2016). AudioPitchShift. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioPitchShift.html

BibTeX

@misc{reference.wolfram_2024_audiopitchshift, author="Wolfram Research", title="{AudioPitchShift}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/AudioPitchShift.html}", note=[Accessed: 09-August-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_audiopitchshift, organization={Wolfram Research}, title={AudioPitchShift}, year={2024}, url={https://reference.wolfram.com/language/ref/AudioPitchShift.html}, note=[Accessed: 09-August-2024 ]}