Pitch Shift (Semitones) — User Guide
Duration-preserving musical transposition by a fixed number of semitones, with interval presets, multichannel processing, peak protection, and visual comparison.
What this does
Pitch Shift (Semitones) transposes a selected Sound by a fixed musical interval while restoring the source duration. Positive values shift upward, negative values shift downward, and zero semitones produces an exact identity copy.
The non-zero path combines a temporary sampling-frequency override with Praat Manipulation resynthesis. The metadata change creates the requested pitch ratio and changes duration; a constant DurationTier then compensates for that duration change through overlap-add resynthesis. The result is finally resampled back to the source sampling frequency.
pitch ratio = 2^(semitones / 12)temporary sample rate = source sample rate × pitch ratio
Quick start
- Select exactly one Sound object in Praat.
- Run
Pitch_Shift_Semitones.praat. - Choose an interval preset, or select Custom and enter a value in Semitones.
- Choose whether to draw the visualization and play the result.
- Click OK. The processed Sound remains selected when the script finishes.
Custom shifts are accepted from −48 to +48 semitones, subject to the temporary sampling-frequency and pitch-analysis safety checks described below.
Interval presets
The preset menu contains 15 fixed musical intervals plus Custom. A fixed preset overrides the numeric Semitones field.
| Preset | Semitones | Output suffix |
|---|---|---|
| Minor 2nd | +1 | m2 |
| Major 2nd | +2 | M2 |
| Minor 3rd | +3 | m3 |
| Major 3rd | +4 | M3 |
| Perfect 4th | +5 | P4 |
| Tritone | +6 | TT |
| Perfect 5th | +7 | P5 |
| Minor 6th | +8 | m6 |
| Major 6th | +9 | M6 |
| Minor 7th | +10 | m7 |
| Major 7th | +11 | M7 |
| Octave Up | +12 | 8ve+ |
| Octave Down | −12 | 8ve- |
| Perfect 5th Down | −7 | P5- |
| Major 3rd Down | −4 | M3- |
| Custom | User value | Numeric value, with + for zero/positive values |
Processing method
Non-zero shifts
- The requested semitone value is converted to the ratio
2^(ST/12). - Each source channel is processed independently.
- The channel's sampling-frequency metadata is temporarily changed to
fs × ratio. This creates the pitch shift but also changes the Sound duration. - A Praat Manipulation object is created on the temporarily shifted Sound.
- A constant DurationTier with value equal to the pitch ratio is added at the actual start and end times of the shifted channel. Overlap-add resynthesis restores the original duration while retaining the transposition.
- The channel is resampled to the original source sampling frequency with precision 50.
- All processed channels are copied into a new Sound with the original time domain, sampling frequency, and channel count.
Adaptive Manipulation range
The base analysis range is 40 Hz to min(1200 Hz, 0.45 × source sample rate). Both bounds are multiplied by the pitch ratio because Manipulation is created after the temporary sampling-frequency override. The lower bound is not allowed below 20 Hz, and the upper bound is limited to 0.45 × temporary sample rate.
The script also rejects a requested shift if the temporary sampling frequency would fall outside 1000–384000 Hz, or if no valid Manipulation range remains.
Zero-semitone identity
If the requested shift is effectively zero, processing is bypassed completely. The script makes an exact copy of the source: there is no sampling-frequency override, Manipulation object, resampling, or peak scaling.
Parameters
| Parameter | Default | Meaning |
|---|---|---|
| Preset | Custom | Selects one of the fixed musical intervals or uses the custom Semitones value. |
| Semitones | 0 | Custom transposition in semitones. Valid range: −48 to +48. Fractional values are allowed. |
| Draw_visualization | Yes | Draws the original/result comparison, spectrograms, interval ruler, and summary. |
| Play_result | Yes | Plays the final Sound after processing. |
Output behavior
- Name:
<source>_<interval suffix>. Examples:voice_P5,voice_8ve-, or a Custom numeric suffix. - Duration: source duration preserved for non-zero shifts; zero semitones is an exact copy.
- Sample rate: restored to the original source sampling frequency.
- Channels: original channel count preserved. Each channel is processed independently with the same semitone value.
- Time domain: the reconstructed result uses the source start and end times.
- Peak handling: on non-zero shifts only, if the final absolute peak exceeds 0.95 the entire result is scaled down to 0.95. Quieter results are not boosted. This is an attenuate-only safety ceiling, not target normalization.
Visualization
When Draw_visualization is enabled, the Picture window uses one semantic direction color for the current state: blue for upward shifts, warm red for downward shifts, and a distinct neutral identity color for zero semitones.
- Original waveform and shifted waveform use one shared symmetric amplitude range, so their levels can be compared directly.
- Spectrogram comparison: original and result are shown side by side up to
min(5000 Hz, 0.45 × source sample rate). The spectrogram image itself is greyscale; the result frame and label carry the shift direction color. - Interval ruler: dynamically spans at least −12 to +12 semitones and expands for larger custom shifts. It marks zero, the travelled interval, direction arrow, endpoint, and numbered semitone ticks.
- Summary: reports direction/identity state, exact shift, interval name, pitch ratio, temporary sample rate, Manipulation range, source duration, channel count, sample rate, and whether peak safety was applied.
For a zero-semitone run, both waveform panels show the same signal and the summary explicitly reports IDENTITY and PSOLA bypass.