Pitch Processor — User Guide

Advanced pitch processing with two distinct modes: Instant Stereo Harmonizer creates stereo width through sample rate manipulation, while Time-Delayed Canon generates multi-voice polyphonic textures with precise timing and pitch control.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.1 (2025) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

What this does

This script implements advanced pitch processing with two fundamentally different approaches to audio manipulation. Mode 1: Instant Stereo Harmonizer creates stereo width and subtle pitch differences by processing left and right channels with different sample rates before combining to stereo. Mode 2: Time-Delayed Canon generates complex polyphonic textures by creating multiple delayed voices, each with precise pitch shifting and amplitude control, mixed down to a rich mono result.

Key Features:

What are pitch processing techniques? Traditional pitch shifting: time-stretching, formant preservation, harmonizers. This processor: Two specialized approaches. Stereo Harmonizer: Creates width through subtle pitch and timing differences between channels — psychoacoustically creates spacious stereo image from mono sources. Time-Delayed Canon: Musical canon technique adapted for digital audio — multiple voices enter at timed intervals with pitch variations, creating complex polyphonic textures. Advantages: (1) Musical precision: Semitone-accurate pitch control. (2) Temporal control: Precise voice entry timing. (3) Dynamic shaping: Progressive amplitude changes. (4) Quality preservation: High-quality resampling algorithms. Use cases: Stereo enhancement, musical arrangement, sound design, experimental composition, vocal processing, instrumental enhancement.

Technical Implementation: (1) Mode 1 (Stereo Harmonizer): Create two copies of source, apply different sample rates to each channel (left: original rate, right: overridden rate), resample both to target rate, combine to stereo. (2) Mode 2 (Time-Delayed Canon): For each voice: calculate pitch shift factor (2^(semitones/12)), override sampling frequency to achieve pitch shift, resample to target rate, apply precise delay through zero-padding, scale intensity based on voice position, mix all voices with careful duration matching. (3) Quality control: High-precision resampling (50-point by default), sample-rate conversion, peak normalization, intermediate object cleanup. Key insight: Pitch shifting via sample rate manipulation preserves audio quality when combined with high-quality resampling. Temporal precision achieved through mathematical sample calculation and zero-padding.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…pitch_processor.praat.
  3. Choose Operation Mode: Instant Stereo Harmonizer or Time-Delayed Canon.
  4. For Stereo Harmonizer:
    • Set Override_sample_rate for right channel (default 40000 Hz)
  5. For Time-Delayed Canon:
    • Choose Preset or "Custom" for manual control
    • Set Number_of_voices (polyphony level)
    • Adjust Delay_between_entries (voice timing)
    • Set Semitone_step (pitch interval between voices)
    • Configure Wrap_to_octave (limit pitch range)
    • Set Start_intensity_dB and Intensity_step_dB
  6. Configure Global Settings:
    • Output_sample_rate (default 44100 Hz)
    • Resample_precision (quality, default 50)
    • Play_after_processing (immediate preview)
    • Keep_intermediate_objects (debugging)
  7. Click OK — processing applied, result appears in Objects window.
Quick tip: Start with Stereo Harmonizer for simple width enhancement — creates instant stereo from mono sources. Use Time-Delayed Canon with Major Arpeggio preset for musical harmonization. For experimental textures, try Spooky Cluster with dense semitone intervals. Octave Stacks creates powerful layered effects. Higher resample_precision values (up to 100) improve quality but increase processing time. Keep Keep_intermediate_objects disabled for cleaner workspace. Processing time increases with voice count in Canon mode — complex settings may take several seconds.
Important: SOURCE-DEPENDENT RESULTS — both modes work best with monophonic, pitched sources (vocals, solo instruments). Polyphonic or noisy material may produce unpredictable results. Extreme pitch shifts (> ±24 semitones) can cause artifacts. Very short delay times (< 0.1s) in Canon mode may create phasing effects. High voice counts (> 8) with significant delays can create very long output files. The algorithm is destructive — original timing and pitch relationships are altered. Always save your original sound before processing. Stereo Harmonizer creates subtle effects — don't expect dramatic pitch changes.

Operation Modes

Mode 1: Instant Stereo Harmonizer

🎧 Stereo Width Enhancement

Concept: Creates stereo image from mono sources through subtle pitch and timing differences

Technique: Independent sample rate processing for left/right channels

Result: Psychoacoustically enhanced stereo width

Best for: Mono-to-stereo conversion, subtle spatial enhancement

Processing Pipeline:

STEP 1: Source Preparation Select mono Sound object Create two independent copies STEP 2: Left Channel Processing Copy 1: "temp_L_raw" Resample to output_sample_rate → Left channel complete STEP 3: Right Channel Processing Copy 2: "temp_R_raw" Override sampling frequency: override_sample_rate Resample to output_sample_rate → Right channel complete STEP 4: Stereo Combination Combine left + right channels to stereo Rename: "originalname_stereo_shift" STEP 5: Cleanup Remove intermediate objects

How Stereo Harmonization Works

Psychoacoustic principles:

Sample Rate Difference Effect:
Left channel: Original sample rate → resampled to target
Right channel: Overridden sample rate → resampled to target

Resulting Differences:
1. Micro-timing variations: Slight phase differences
2. Subtle pitch variations: Minor frequency shifts
3. Spectral variations: Different resampling artifacts

Perceptual Result:
Brain interprets differences as spatial information
Creates impression of stereo width and depth
More natural than artificial stereo wideners

Mode 2: Time-Delayed Canon

🎵 Polyphonic Texture Generation

Concept: Musical canon technique adapted for digital audio processing

Technique: Multiple delayed voices with progressive pitch shifting

Result: Complex polyphonic textures from monophonic sources

Best for: Musical arrangement, sound design, experimental textures

Processing Pipeline:

STEP 1: Base Preparation Create working copy: "base" Get original sampling frequency: f0 STEP 2: Voice Generation Loop (for each voice v) A. Pitch Calculation: semitones = (v-1) × semitone_step If wrap_to_octave: semitones = semitones mod 12 factor = 2^(semitones/12) f_override = round(f0 × factor) B. Voice Creation: Copy base → "voice_raw" Override sampling frequency: f_override Resample to output_sample_rate Convert to mono → "voice" Cleanup intermediate C. Delay Application: delay_time = (v-1) × delay_between_entries If delay_time > 0: prepend silence padding D. Intensity Scaling: gain_dB = start_intensity_dB + (v-1) × intensity_step_dB Scale intensity: gain_dB E. Mixing: If first voice: rename to "mix" Else: carefully mix with existing mix Ensure sample rate matching Ensure duration matching Convert stereo→mono for mixing Scale peak to prevent clipping STEP 3: Finalization Rename mix: "originalname_canon_mix" Cleanup base object

Canon Musical Structure

Traditional canon adapted for audio:

Voice 1: Original pitch, no delay, full intensity
Voice 2: Pitch + semitone_step, delay_between_entries, reduced intensity
Voice 3: Pitch + 2×semitone_step, 2×delay, further reduced intensity
...
Voice N: Pitch + (N-1)×semitone_step, (N-1)×delay, minimum intensity

Musical Effects:
- Arpeggio: When semitone_step creates chord tones
- Cluster: When semitone_step = 1 (dense semitones)
- Octaves: When semitone_step = 12 (octave doubling)
- Complex textures: With wrap_to_octave and larger steps

Mode Comparison

AspectStereo HarmonizerTime-Delayed Canon
OutputStereoMono
ProcessingFast, simpleComplex, iterative
EffectSpatial widthPolyphonic texture
Use CaseStereo enhancementMusical arrangement
Voice CountFixed 2 (L/R)Configurable (1-10+)
Pitch ControlSubtle, implicitPrecise, explicit
TimingMicro-differencesMusical timing

Technical Theory

Pitch Shifting Mathematics

Sample Rate Manipulation

Pitch shifting via sample rate override:

Pitch shift factor calculation: factor = 2^(semitones / 12) Where: semitones = desired pitch shift (positive = up, negative = down) factor = sampling frequency multiplier New sampling frequency: f_new = f_original × factor Example: Shift up 7 semitones (perfect fifth) factor = 2^(7/12) ≈ 1.498 f_new = 44100 × 1.498 ≈ 66050 Hz After resampling to target rate (44100 Hz): Pitch is shifted up by 7 semitones Duration is preserved (unlike time-stretching)

Why This Approach?

Advantages of sample rate pitch shifting:

Limitations and considerations:

Resampling Theory

High-Quality Sample Rate Conversion

Resampling precision parameter:

Praat's Resample function uses sinc interpolation: precision = 50 (default) means: Sinc kernel with 50 points (25 each side) High-quality low-pass filtering Minimal aliasing artifacts Higher precision values: precision = 100: Excellent quality, slower precision = 25: Faster, slightly reduced quality The resampling process: 1. Apply anti-aliasing filter (sinc kernel) 2. Interpolate to new sample rate 3. Maintain spectral integrity For pitch shifting: Quality critical due to frequency domain manipulation

Temporal Precision

Sample-Accurate Timing

Delay implementation through zero-padding:

Delay calculation: delay_samples = delay_seconds × output_sample_rate Padding creation: Create Sound from formula: "pad", 1, 0, delay_seconds, output_sample_rate, "0" Concatenation: [silence_padding] + [voice_sound] = delayed_voice Precision: Sample-accurate timing (no rounding to block size) Mathematical exactness for musical timing Perfect synchronization between voices Example: 0.5s delay at 44100 Hz delay_samples = 0.5 × 44100 = 22050 samples Exactly 0.500000 seconds delay

Mixing Mathematics

Multi-Voice Combination

Careful signal addition:

Intensity scaling in dB: gain_linear = 10^(gain_dB / 20) Mixing process: mixed_sample = Σ(voice_sample × gain_linear_voice) Prevention of clipping: Peak detection after each mix operation Scale peak: 0.99 (3 dB headroom) Duration matching: max_duration = max(all_voice_durations) Pad shorter voices with silence Mathematical exactness for sample alignment Stereo-to-mono conversion for mixing: stereo → convert to mono → mix Avoids phase issues in final mono result

Complete Processing Algorithms

Stereo Harmonizer Detailed Algorithm

INPUT: Mono Sound, override_sample_rate, output_sample_rate, resample_precision PROCESS: 1. Select original Sound 2. Copy → "temp_L_raw" 3. Resample: output_sample_rate, resample_precision → "L_final" 4. Select original Sound 5. Copy → "temp_R_raw" 6. Override sampling frequency: override_sample_rate 7. Resample: output_sample_rate, resample_precision → "R_final" 8. Select L_final + R_final 9. Combine to stereo → "output_stereo" 10. Remove temp_L_raw, temp_R_raw, L_final, R_final OUTPUT: Stereo Sound with subtle L/R differences

Time-Delayed Canon Detailed Algorithm

INPUT: Sound, number_of_voices, delay_between_entries, semitone_step, wrap_to_octave, start_intensity_dB, intensity_step_dB, output_sample_rate, resample_precision INIT: Copy original → "base" f0 = Get sampling frequency id_mix = 0 FOR v FROM 1 TO number_of_voices: // PITCH CALCULATION s = (v-1) × semitone_step IF wrap_to_octave: s = s mod 12 factor = 2^(s/12) f_override = round(f0 × factor) // VOICE CREATION Copy base → "voice_raw" Override sampling frequency: f_override Resample: output_sample_rate, resample_precision Convert to mono → "voice" Cleanup intermediates // DELAY APPLICATION d = (v-1) × delay_between_entries IF d > 0: Prepend d seconds of silence // INTENSITY SCALING gain_dB = start_intensity_dB + (v-1) × intensity_step_dB Scale intensity: gain_dB // MIXING IF v = 1: Rename → "mix" id_mix = selected ELSE: Ensure both mix and voice at output_sample_rate Match durations with zero-padding Combine to stereo → Convert to mono → Scale peak: 0.99 Update id_mix Cleanup intermediates FINAL: Rename id_mix → "originalname_canon_mix" Remove base OUTPUT: Mono Sound with multi-voice canon texture

Canon Presets

Preset 1: Custom

🎛️ Full Parameter Control

Character: Complete manual control over all canon parameters

Use case: Experimental sound design, specific musical requirements

Recommended for: Advanced users, specific musical applications

Preset 2: Major Arpeggio (Fast)

🎹 Musical Chord Arpeggiation

Settings: voices=4, delay=0.25s, semitone_step=4, no octave wrap, intensity_step=-3dB

Character: Fast, musical arpeggio using major third intervals

Musical result: Creates major chord arpeggios (root, major third, fifth, major seventh)

Best for: Melodic material, chordal enhancement, musical arrangement

Preset 3: Spooky Cluster (Slow)

👻 Dense Microtonal Texture

Settings: voices=5, delay=1.2s, semitone_step=1, no octave wrap, intensity_step=-1dB

Character: Slow, dense cluster of closely spaced pitches

Musical result: Creates tense, complex textures with minimal pitch variation

Best for: Atmospheric sounds, horror effects, experimental textures

Preset 4: Octave Stacks

📊 Powerful Octave Doubling

Settings: voices=3, delay=0.5s, semitone_step=12, no octave wrap, intensity_step=-2dB

Character: Strong, powerful octave doubling effect

Musical result: Creates thick, reinforced textures through octave stacking

Best for: Bass enhancement, powerful leads, impactful sounds

Preset Musical Analysis

PresetIntervals CreatedMusical CharacterTempo Feel
Major ArpeggioP1, M3, P5, M7Bright, consonantFast (0.25s)
Spooky ClusterP1, m2, M2, m3, M3Dense, dissonantSlow (1.2s)
Octave StacksP1, P8, P15Powerful, reinforcedMedium (0.5s)

Creating Custom Presets

Musical interval guide:
  • 0: Unison (thickening)
  • 1: Minor second (cluster)
  • 2: Major second (whole tone)
  • 3: Minor third (dark)
  • 4: Major third (bright)
  • 5: Perfect fourth (open)
  • 7: Perfect fifth (powerful)
  • 12: Octave (reinforcement)

Combine with wrap_to_octave for complex patterns within one octave

Parameters & Controls

Global Parameters

ParameterTypeRangeDefaultDescription
Output_sample_ratepositive8000-19200044100Final output sample rate
Resample_precisionpositive10-10050Resampling quality
Play_after_processingboolean0/11Auto-play result
Keep_intermediate_objectsboolean0/10Keep temp objects (debug)

Stereo Harmonizer Parameters

ParameterTypeRangeDefaultDescription
Override_sample_ratepositive8000-19200040000Right channel sample rate

Time-Delayed Canon Parameters

ParameterTypeRangeDefaultDescription
Number_of_voicesnatural1-204Polyphony level
Delay_between_entriespositive0.0-10.00.5Voice entry timing
Semitone_stepinteger-24 to +247Pitch interval
Wrap_to_octaveboolean0/11Limit to one octave
Start_intensity_dBreal0-10070First voice level
Intensity_step_dBreal-20 to +20-3Level change per voice

Parameter Effects Guide

Number_of_voices (1-20):
1-3: Sparse, transparent
4-6: Rich, musical
7-10: Dense, complex
>10: Very dense, potentially muddy

Delay_between_entries (0.0-10.0s):
0.0-0.1: Rhythmic, phasing effects
0.2-0.5: Musical timing, arpeggios
0.6-2.0: Clear entrances, canon effect
>2.0: Spacious, atmospheric

Semitone_step (-24 to +24):
0: Unison thickening
1: Microtonal cluster
3-5: Chord intervals
7: Perfect fifth
12: Octave

Intensity_step_dB (-20 to +20):
Negative: Fading trail (canon)
0: Equal voices (chorus)
Positive: Building intensity (crescendo)

Applications

Stereo Enhancement

Use case: Converting mono recordings to stereo

Technique: Stereo Harmonizer mode

Workflow: Process mono sources, mix with original for width control

Musical Arrangement

Use case: Creating harmonies and arrangements from monophonic material

Technique: Time-Delayed Canon with musical intervals

Examples: Vocal harmonies, instrumental arrangements, chord generation

Sound Design

Use case: Creating complex textures from simple sources

Technique: Canon mode with extreme parameters

Applications: Atmospheric beds, rhythmic textures, experimental sounds

Vocal Processing

Use case: Enhancing vocals with harmonies and spatial effects

Technique: Both modes for different effects

Considerations: Maintain intelligibility, use musical intervals

Instrumental Enhancement

Use case: Adding depth and richness to solo instruments

Technique: Canon mode with complementary intervals

Examples: Guitar doubling, string sections, brass ensembles

Practical Workflow Examples

🎤 Vocal Harmony Creation

Goal: Add natural harmonies to lead vocal

Settings:

  • Mode: Time-Delayed Canon
  • Preset: Major Arpeggio or Custom
  • Voices: 3-4, Delay: 0.0s (simultaneous)
  • Intervals: +3, +7 semitones (third, fifth)
  • Mix with original for balance

Result: Natural vocal harmonies supporting lead line

🎸 Guitar Thickening

Goal: Create rich guitar textures from single takes

Settings:

  • Mode: Stereo Harmonizer for width
  • Plus: Canon mode with octave doubling
  • Process separately and mix
  • Use subtle settings for natural result

Result: Thick, professional guitar sound

🌌 Ambient Pad Generation

Goal: Create evolving pads from short sounds

Settings:

  • Mode: Time-Delayed Canon
  • Preset: Spooky Cluster or Custom
  • Long delays (2-5s), many voices (6-8)
  • Subtle pitch variations
  • Fading intensity trail

Result: Complex, evolving ambient textures

Advanced Techniques

Layered processing:
  • Multiple passes: Apply different modes sequentially
  • Section processing: Different settings for verse/chorus
  • Hybrid approaches: Stereo width + canon textures
  • Parameter automation: Change settings over time

Experiment with unconventional source material for unique results

Creative applications:
  • Rhythmic canons: Use very short delays for phasing
  • Microtonal exploration: Fractional semitone steps
  • Extreme settings: Push parameters beyond normal ranges
  • Source manipulation: Process already-processed material

Troubleshooting Common Issues

Problem: Output too long/too much silence
Cause: High voice count with long delays
Solution: Reduce number_of_voices or delay_between_entries
Problem: Muddy/unclear result
Cause: Too many voices or inappropriate intervals
Solution: Reduce voice count, use clearer intervals (4ths, 5ths, octaves)
Problem: Stereo effect too subtle
Cause: Similar sample rates in Stereo Harmonizer
Solution: Increase difference between original and override rates
Problem: Artifacts/distortion
Cause: Extreme pitch shifts or low resample precision
Solution: Reduce semitone_step, increase resample_precision

Technical Deep Dive

Sample Rate Conversion Mathematics

Sinc Interpolation Theory

High-quality resampling foundation:

Sinc interpolation formula: x(t) = Σ[n=-∞ to ∞] x[n] × sinc(π(t/T - n)) Where: x[n] = original samples t = continuous time T = sampling period sinc(x) = sin(x)/x Practical implementation: Finite kernel: precision points (50 default) Windowing to reduce Gibbs phenomenon Optimal low-pass filtering For pitch shifting: Quality critical due to frequency domain manipulation Higher precision = better anti-aliasing

Pitch Perception Psychology

How We Hear Pitch Differences

Psychoacoustic principles in stereo perception:

Micro-pitch differences:
Just Noticeable Difference (JND): ~0.5-1% for pure tones
In complex signals: slightly higher thresholds

Stereo perception mechanisms:
1. Interaural Time Differences (ITD): Micro-timing between ears
2. Interaural Level Differences (ILD): Amplitude differences
3. Spectral differences: Frequency content variations

Stereo Harmonizer exploits:
- ITD through resampling timing differences
- Spectral differences through resampling artifacts
- Creates convincing stereo image from mono

Computational Complexity Analysis

Processing Time Estimation

Big-O analysis for each mode:

Stereo Harmonizer: Time: O(N × P) Where: N = samples, P = resample precision Very fast: ~2 × N × P operations Time-Delayed Canon: Time: O(V × N × P) Where: V = number_of_voices Scales linearly with voice count Memory usage: Stereo Harmonizer: O(N) (temporary copies) Time-Delayed Canon: O(V × N) (multiple voice storage) For typical values: N = 441,000 (10 seconds at 44.1 kHz) P = 50, V = 4 Canon operations ≈ 4 × 441,000 × 50 = 88,200,000