Auto‑Harmonic Layering (Enhanced) — User Guide
One‑step loop harmonizer with enhanced features: automatically detects repeating pitch patterns and applies chord‑based harmonization with individual voice control, smooth fades, and flexible output options.
- Individual Chord Level Control: Adjust root, 2nd, and 3rd voice volumes independently
- Smooth Fade Envelopes: Automatic fade-in/fade-out on chords for seamless blending
- Consistent Chord Assignment: Each loop keeps the same chord across all its repeats
- Harmonization Scope Controls: Choose to harmonize only loops or limit to time range
- Mono Output Option: Convert final mix to mono for single-channel compatibility
What this does
This script implements a complete audio harmonization pipeline that (1) automatically detects repeating pitch patterns (loops) in monophonic audio, then (2) applies chord‑based harmonization to those loops to create rich, layered textures. Unlike simple pitch‑shifting or harmonizer effects, this intelligently identifies meaningful repetitions (melodic motifs, phrases, patterns) and applies musically‑informed chord voicings (octaves, fifths, triads) to transform monophonic sources into harmonically rich arrangements.
Key Features:
- Two‑Step Processing: Loop detection → intelligent harmonization
- 7 Chord Types: Octave doubling, fifth (power chord), major, minor, sus4, sus2, random
- Individual Voice Control: Adjust root, 2nd, and 3rd note levels independently (0-1)
- Smooth Fade Envelopes: Automatic fade-in/out prevents clicks, ensures seamless blending
- Consistent Loop Chords: Each loop number maintains same harmony across all repeats
- Flexible Scope: Harmonize loops only, repeats only, or limit by time range
- Automatic Pattern Recognition: Finds meaningful repetitions, not just fixed‑time loops
- Smart Mixing: Preserves original audio, blends harmonies at adjustable volume
- Dual Output Modes: Stereo (original + chords) or Mono (mixed together)
- Turbo Optimization: Fast matrix‑based loop detection (C++ engine)
- Clean Workflow: Removes all temporary objects, leaves only final result
- Selective: Only harmonizes repeating patterns (not everything)
- Musical: Uses chord intervals (3rds, 5ths, octaves) not just random shifts
- Context‑aware: Harmonizes loops where they actually repeat
- Layered: Creates three‑voice chords from single‑voice source
- Controllable: Each voice (root, 2nd, 3rd) has independent volume control
- Smooth: Automatic fades prevent abrupt starts/stops
- Creative: Turns monophonic material into rich, evolving textures
Technical Pipeline: Phase 1: Loop Detection — Extract pitch contour, compute similarity matrix, find diagonal patterns, annotate loops in TextGrid, assign consistent chord to each loop number. Phase 1B: Chord Assignment — Each loop number gets one chord type (all repeats share it). Phase 2: Harmonization — Extract loop segments, apply interval‑based pitch‑shifting with individual voice levels, apply fade envelopes, reconstruct timeline. Phase 3: Mixing — Blend harmonized track with original, output as stereo or mono. Uses Praat's Manipulation objects for high‑quality pitch‑shifting.
New Features (v0.3)
1. Individual Chord Level Control
🎚️ Independent Voice Volume Control
Parameters:
Root_level(0-1, default 1.0) — Volume of original pitchNote_2_level(0-1, default 0.8) — Volume of 2nd intervalNote_3_level(0-1, default 0.6) — Volume of 3rd interval
Creative uses:
- Prominent root: 1.0 / 0.6 / 0.4 — Melody leads, harmonies subtle
- Balanced triad: 0.8 / 0.8 / 0.8 — Equal voices
- Upper voice emphasis: 0.7 / 1.0 / 0.9 — Highlights harmony
- Hollow fifth: 0.9 / 0.2 / 0.8 — De-emphasize middle note
Example: For major chord (root + 4 + 7 semitones), setting levels to 1.0 / 0.7 / 0.5 creates a natural voicing where upper notes support but don't overpower the melody.
2. Smooth Fade Envelopes
🌊 Automatic Fade-In/Fade-Out
Parameters:
Fade_duration(seconds, default 0.01) — Length of fade-in and fade-outApply_fades(checkbox, default ON) — Toggle fades on/off
How it works:
- Fade-in applied to start of each chord segment
- Fade-out applied to end of each chord segment
- Automatic limiting: fade never exceeds 25% of segment duration
- Prevents clicks/pops when chords start or end
- Creates seamless blending with melody
Recommended settings:
- Subtle blending: 0.015 - 0.02s (smooth, unnoticeable)
- Percussive: 0.005 - 0.01s (sharper attack)
- Ambient: 0.03 - 0.05s (very smooth, pad-like)
3. Consistent Chord Assignment
In previous versions, each event (Loop 1, Repeat 1, Repeat 2...) could get different random chords. Now:
- Loop 1 assigned (e.g.) Major → All Repeat 1 instances also get Major
- Loop 2 assigned (e.g.) Minor → All Repeat 2 instances also get Minor
- Creates harmonic coherence: same melodic pattern always has same harmony
- Makes musical sense: listeners recognize the pattern and its harmony
Example: If your melody has a motif that repeats 3 times, all 3 instances will have the same chord voicing, creating a unified harmonic identity for that motif.
4. Harmonization Scope Controls
Parameters:
| Parameter | Type | Default | Purpose |
|---|---|---|---|
Harmonize_repeats |
Checkbox | ON | Include "Repeat" intervals in harmonization |
Harmonize_until_time |
Seconds | 0 (full) | Only harmonize events before this time |
Use cases:
- Loops only: Uncheck
Harmonize_repeatsto process only original loops - Time-limited: Set
Harmonize_until_timeto 6.0 to stop harmonization at 6 seconds - Solve "harmony after melody ends": If melody fades/ends at 8s but repeats occur later, set limit to 8.0
5. Mono Output Option
Output_mono (checkbox, default OFF)
- OFF (Stereo): Original in left channel, harmonies in right channel — allows separate control in DAW
- ON (Mono): Original + harmonies mixed together in single channel — simpler, single-track output
When to use mono: Broadcasting, podcasts, phone playback, or when you want harmonies fully integrated with original.
When to use stereo: Music production (for further mixing), creative panning effects, or when you want to adjust balance later.
Quick start
- In Praat, select exactly one Sound object (monophonic material works best).
- Run script… →
auto_harmonic_layering_enhanced.praat. - Set Loop Detection parameters (or keep defaults):
- Time_step: 0.05s (fast) or 0.02s (precise)
- Pitch_floor/ceiling: Match your audio's pitch range
- Tolerance_hz: 30‑50 Hz for speech, 50‑100 Hz for expressive music
- Num_loops_to_find: 3‑10 depending on density
- Choose Chord_Type:
- Octave Doubling: Thick, orchestral (root + octave + 2 octaves)
- Fifth: Power chord, rock/metal (root + fifth + octave)
- Major/Minor: Traditional triads
- Sus4/Sus2: Suspended, ambiguous harmonies
- Random: Mix of all types for variation
- NEW: Set Chord Mixing Levels:
- Root_level: 1.0 (full volume for melody)
- Note_2_level: 0.8 (slightly quieter 2nd voice)
- Note_3_level: 0.6 (quieter 3rd voice for depth)
- NEW: Configure Envelope Settings:
- Fade_duration: 0.01s (default, subtle fades)
- Apply_fades: Check ON for smooth blending
- NEW: Set Harmonization Scope:
- Harmonize_repeats: Keep ON to harmonize both loops and repeats
- Harmonize_until_time: 0 for full duration, or set to limit (e.g., 10.0)
- Set Mix_volume: 0.3‑0.7 (overall harmony loudness).
- NEW: Choose Output_mono: OFF for stereo, ON for mono.
- Click OK — script runs three phases (watch Info window).
- Output:
Final_Mix_StereoorFinal_Mix_Mono. - Also creates:
Harmonized_Track(harmonies only). - Sound auto‑plays after processing.
🎯 Recommended Presets
Subtle Background Harmonies:
- Chord: Major or Minor
- Root/Note2/Note3: 1.0 / 0.6 / 0.4
- Fade: 0.015s, ON
- Mix_volume: 0.4
- Output: Mono
Bold Power Chord Effect:
- Chord: Fifth
- Root/Note2/Note3: 0.8 / 1.0 / 0.9
- Fade: 0.008s, ON
- Mix_volume: 0.6
- Output: Stereo
Ambient Pad Texture:
- Chord: Sus4 or Random
- Root/Note2/Note3: 0.7 / 0.8 / 0.7
- Fade: 0.03s, ON
- Mix_volume: 0.5
- Harmonize_until_time: Set to where melody ends
- Output: Stereo
Complete Parameter Reference
Loop Detection Settings
| Parameter | Range/Type | Default | Description |
|---|---|---|---|
Time_step |
0.01 - 0.1s | 0.05s | Analysis frame rate. 0.05 = fast, 0.02 = precise |
Pitch_floor |
50 - 200 Hz | 75 Hz | Minimum detectable pitch |
Pitch_ceiling |
300 - 1500 Hz | 600 Hz | Maximum detectable pitch |
Tolerance_hz |
10 - 200 Hz | 50 Hz | Pitch similarity threshold for loop detection |
Min_loop_duration |
0.1 - 5.0s | 0.4s | Minimum loop length to detect |
Max_loop_duration |
1.0 - 60.0s | 10.0s | Maximum loop length (optimization limit) |
Num_loops_to_find |
1 - 20 | 5 | How many top loops to detect |
Harmonization Settings
| Parameter | Range/Type | Default | Description |
|---|---|---|---|
Mix_volume |
0.0 - 1.0 | 0.5 | Overall harmony track volume (peak scaling) |
Chord_Type |
Choice menu | Random | Octave/Fifth/Major/Minor/Sus4/Sus2/Random |
Harmonization Scope NEW
| Parameter | Type | Default | Description |
|---|---|---|---|
Harmonize_repeats |
Boolean | ON | Include "Repeat" tier intervals in harmonization |
Harmonize_until_time |
0 - duration | 0 (full) | Stop harmonizing after this time (0 = no limit) |
Chord Mixing Levels NEW
| Parameter | Range | Default | Description |
|---|---|---|---|
Root_level |
0.0 - 1.0 | 1.0 | Volume of original pitch (root note) |
Note_2_level |
0.0 - 1.0 | 0.8 | Volume of 2nd interval in chord |
Note_3_level |
0.0 - 1.0 | 0.6 | Volume of 3rd interval in chord |
Envelope Settings NEW
| Parameter | Range/Type | Default | Description |
|---|---|---|---|
Fade_duration |
0.001 - 0.1s | 0.01s | Length of fade-in and fade-out (auto-limited to 25% of segment) |
Apply_fades |
Boolean | ON | Enable/disable automatic fade envelopes |
Output Format NEW
| Parameter | Type | Default | Description |
|---|---|---|---|
Output_mono |
Boolean | OFF | Convert final mix to mono (ON) or keep stereo (OFF) |
Output & Results
Created Objects
| Object | Description | Use |
|---|---|---|
Final_Mix_Stereo |
Stereo mix: original (L) + harmonies (R) | Main output when Output_mono = OFF |
Final_Mix_Mono |
Mono mix: original + harmonies combined | Main output when Output_mono = ON |
Harmonized_Track |
Harmonies only (mono) | Export separately for mixing, or listen to harmony layer alone |
- Export stems: Save both Final_Mix and Harmonized_Track for DAW mixing
- Adjust balance: In stereo mode, pan/volume control each channel separately
- Further processing: Apply EQ, reverb, compression to harmony track independently
- Layer multiple passes: Process same audio multiple times with different chord types, then blend
Info Window Output
The script reports:
- Number of loops found
- NEW: Chord assignment for each loop number (e.g., "Loop 1: Major, Loop 2: Minor")
- NEW: Number of events skipped (if using harmonization scope limits)
- NEW: Harmonization end time (if limited)
- Number of events harmonized
- NEW: Fade duration (if enabled)
- NEW: Output format (Mono/Stereo)