Formant Chord Player — v0.2 User Guide
Re‑analyses the selected sound, extracts F1–F4 per segment, and renders each segment as a 4‑voice additive chord using a mellow multi‑partial waveform (soft organ/cello tone) shaped by a piano ADSR envelope. Produces both a MusicXML score (printed to the Info window) and an audio rendering.
What this does
Formant Chord Player is the audio companion to the Formant_to_MusicXML_Chord_Converter. It takes the same source sound, segments it, extracts the first four formant frequencies (F1–F4) per segment, and synthesises a 4‑voice additive chord for each segment. The synthesis uses:
- A mellow multi‑partial waveform (sum of
num_harmonicssine partials with 1/k amplitude and Gaussian rolloff). - Piano ADSR envelope (attack, decay, sustain, release) applied independently to each voice.
- Staggered onset – each voice (F1–F4) starts a few milliseconds after the previous, creating a natural arpeggiation.
- Register correction – frequencies are transposed into the range C2–C5 (65–523 Hz) to keep the output in a playable keyboard range.
Quick start
- In Praat, select exactly one Sound object (mono or stereo).
- Run script… →
Formant_to_MusicXML_Chord_Converter.praat(or the player script). - Set Number_of_segments – how many time segments to analyse (should match the Converter’s setting).
- Adjust synthesis parameters:
- Transpose_semitones – global pitch shift for the rendered chords (default -24 to bring formants into playable range).
- Note_duration_s – length of each chord (seconds).
- Attack_s, Decay_s, Sustain_level, Release_s – piano ADSR envelope.
- Stagger_s – delay between successive voices (F1→F2→F3→F4).
- Num_harmonics – number of partials in the additive waveform (1–8).
- Click OK. The script extracts formants, prints MusicXML to the Info window, synthesises chords, concatenates them, and creates a new Sound object named
formant_chords_originalname.
Create Sound from formula with a sum of sinusoids. For many segments (e.g., 32) and many harmonics (e.g., 8), synthesis can be slow. Increase Note_duration_s to hear longer chords, but processing time scales linearly.
Synthesis engine
wave(t) = Σk=1N Ak · sin(2π·k·f·t)where
Ak = (1/k) · exp( –(k‑1)² / (2·σ²) ) · gainwith σ = 2.0 (Gaussian rolloff) and
gain per voice (F1=1.00, F2=0.80, F3=0.60, F4=0.45).
Per‑voice processing
- Register correction – transposes the formant frequency by octaves until it falls within C2 (65 Hz) and C5 (523 Hz).
- Global transpose – applies the user‑defined Transpose_semitones shift.
- Waveform generation – creates a
num_harmonics‑partial additive tone at the corrected frequency. - Onset stagger – the voice starts at
(voice_index‑1) × stagger_sseconds after the segment start. - ADSR envelope – applied in four stages:
- Attack: linear rise from 0 to 1 over
attack_sseconds. - Decay: fall from 1 to
sustain_leveloverdecay_sseconds. - Sustain: hold at
sustain_leveluntil the release point. - Release: linear fall from
sustain_levelto 0 overrelease_sseconds.
- Attack: linear rise from 0 to 1 over
- Mix – all four voices are summed into a single chord buffer per segment.
After all segments are synthesised, they are concatenated into a single output sound. The MusicXML output shows the target pitches (before register correction), not the synthesised octave.
Parameters & defaults
Analysis
| Parameter | Range | Default | Description | ||
|---|---|---|---|---|---|
| Number_of_segments | ≥1 | 8 | 。|||
| Max_formant_Hz | 500–8000 | 5500 | 。
Pitch & timing
| Parameter | Range | Default | Description | ||
|---|---|---|---|---|---|
| Transpose_semitones | -36–36 | -24 | 。|||
| Note_duration_s | 0.1–10 | 1.2 | 。
ADSR envelope
| Parameter | Range | Default | Description |
|---|---|---|---|
| Attack_s | 0–1 | 0.025 | 。
Voice articulation
| Parameter | Range | Default | Description | ||
|---|---|---|---|---|---|
| Stagger_s | 0–0.2 | 0.018 | 。|||
| Num_harmonics | 1–8 | 3 | 。
Output
Visualization (staff‑notation style)
When Draw_visualization = 1, the script draws a staff‑notation visualisation:
- Treble and/or bass clef staves (drawn automatically depending on pitch range).
- Coloured noteheads for F1 (red), F2 (blue), F3 (green), F4 (cyan).
- Ledger lines for notes above/below the staff.
- Segment numbers below the staff.
- Formant frequency annotations (Hz) next to each notehead.
- Legend for the four voices.
- Parameter summary (segment count, note duration, harmonics, stagger, ADSR values).
FAQ / troubleshooting
The script prints MusicXML directly to the Info window. Copy the entire output (starting from <?xml version="1.0"...> to </score-partwise>) and paste it into a text file with a .musicxml extension. Then import into MuseScore, Finale, or any MusicXML‑compatible notation software.
The register correction moves formant frequencies by octaves into the C2–C5 range. If a formant is 110 Hz (A2), it stays at 110 Hz. If it’s 880 Hz (A5), it is halved to 440 Hz (A4). This can produce unexpected intervals. Adjust Transpose_semitones globally, or edit the regLow and regHigh variables in the script (lines near the top).
Each voice is synthesised with a Create Sound from formula call that builds a sum of sinusoids. For 32 segments × 4 voices × 8 harmonics = 1024 sinusoids, each formula is evaluated across thousands of samples. This can take tens of seconds. Reduce Num_harmonics to 2–3, or increase Note_duration_s to reduce the number of segments.
The synthesis path: original formant (Hz) → register correction (octave shifts into C2–C5) → add transpose_semitones → generate additive tone. The MusicXML output uses the original formant pitch (after register correction but before transpose), so the score matches the rendered audio’s register.
Gain factors are fixed: F1=1.00, F2=0.80, F3=0.60, F4=0.45. These are hardcoded in the script (line with fGain[1] = 1.00 etc.). You can edit them to emphasise higher or lower formants.