Bimodal Contour Grammar — User Guide
Generates phrase-level pitch contours from an Onset → Nucleus → Coda grammar, resynthesizes the selected sound with the generated contour, and draws the same pitch-event stream as a visual contour.
What this does
Bimodal Contour Grammar generates a new pitch contour over the duration of the selected sound. Each phrase follows the rule Phrase → Onset + Nucleus + Coda. The onset is either a near-instantaneous upward jump or an upward glissando; the nucleus is either a plateau or a wobble; and the coda is a downward fall or deeper drop.
Every generated pitch point is sent through the same addPoint procedure: it is added to the output PitchTier and used to draw the main contour. The visual attributes are not identical to the audio dynamics: colour, line thickness, and dot size are driven by the source sound's measured intensity, while output loudness is controlled separately by phrase-level generated dynamics.
Quick start
- In Praat, select exactly one Sound object.
- Run
Bimodal_Contour_Grammar.praat. - Choose Custom or one of the five supplied presets.
- For Custom, set the base pitch range, gesture speed, interval scale, and wobble depth.
- Choose a random seed, colour scheme, line style, audio loudness settings, and display options.
- Click OK. The script generates the grammar, resynthesizes the sound, draws the visualization, and selects the resulting Sound object.
0 creates an unpredictable seed and prints the actual seed in the Info window. Any non-zero integer initializes the script's deterministic LCG and can reproduce the same grammar choices when the source duration and grammar/audio parameters are unchanged.
Presets
The presets override only the five grammar-shaping fields shown below. They do not override the seed, colour scheme, line style, dot sizes, loudness controls, grid, note labels, or playback setting.
| Preset | Pitch base (Hz) | Gesture scale | Interval scale | Wobble depth |
|---|---|---|---|---|
| Custom | uses form values | uses form value | uses form value | uses form value |
| Microtonal Murmur | 120–160 | 1.8 | 0.25 | 1.5 Hz |
| Leaping Gestures | 80–250 | 0.9 | 2.0 | 6.0 Hz |
| Rapid Stutter | 140–180 | 0.3 | 0.5 | 3.0 Hz |
| Wide Arc | 60–300 | 1.6 | 1.8 | 8.0 Hz |
| Gentle Drift | 100–200 | 1.4 | 0.7 | 4.0 Hz |
Grammar and gestures
Phrase → Onset + Nucleus + Coda
Onset → JumpUp | GlissUp
Nucleus → Plateau | Wobble
Coda → Fall | DeepDrop
At the start of each full phrase, a new base pitch is drawn uniformly from Pitch_base_lo_Hz … Pitch_base_hi_Hz. The script also draws one phrase-level loudness offset within ±loudnessVariation.
Onset
| Gesture | Duration | Pitch movement | Implementation |
|---|---|---|---|
| JumpUp | random 0.05–0.15 × Gesture_scale | +10 to +30 Hz × Interval_scale | The change occurs within at most 1 ms, then the new pitch is held for the rest of the onset. |
| GlissUp | random 0.05–0.15 × Gesture_scale | +20 to +50 Hz × Interval_scale | The PitchTier interpolates from the starting pitch to the higher pitch across the full onset duration. |
The sampled onset duration is shortened when necessary so that at least 0.30 × Gesture_scale seconds remain for the minimum nucleus and coda.
Nucleus
| Gesture | Duration | Behaviour |
|---|---|---|
| Plateau | random 0.20–0.50 × Gesture_scale | Holds the current pitch. |
| Wobble | random 0.20–0.50 × Gesture_scale | Adds random offsets within ±Wobble_depth_Hz at steps of 0.05 × Gesture_scale, with a 10 ms minimum step, then returns exactly to the centre pitch at the nucleus endpoint. |
The nucleus is shortened when necessary to reserve at least 0.10 × Gesture_scale seconds for the coda.
Coda
| Gesture | Duration | Pitch movement |
|---|---|---|
| Fall | random 0.10–0.20 × Gesture_scale, limited by remaining time | −20 to −40 Hz × Interval_scale |
| DeepDrop | same duration rule | −50 to −80 Hz × Interval_scale |
Both codas are continuous downward PitchTier ramps. The resulting pitch is clamped to a minimum of 50 Hz.
0.05–0.10 × Gesture_scale interval before the next phrase. This is not inserted silence. No extra pitch point is added during the interval, so the PitchTier linearly connects the previous coda endpoint to the next phrase's new base pitch.
If the remaining duration is shorter than 0.35 × Gesture_scale, the script does not start another full phrase. It holds the current pitch to the exact end of the Sound instead.
Parameters
Grammar parameters
| Parameter | Default | Behaviour |
|---|---|---|
Pitch_base_lo_Hz | 100 | Lower bound for each phrase's randomly selected base pitch. Must be lower than Pitch_base_hi_Hz. |
Pitch_base_hi_Hz | 200 | Upper bound for phrase base pitch. |
Gesture_scale | 1.0 | Multiplies gesture durations and inter-phrase interval. Internally clamped to 0.1–5.0. |
Interval_scale | 1.0 | Multiplies JumpUp, GlissUp, Fall, and DeepDrop pitch distances. Internally clamped to 0.05–5.0. |
Wobble_depth_Hz | 5.0 | Maximum positive/negative Wobble offset. Internally clamped to 0.1–50 Hz. |
Randomness
| Parameter | Default | Behaviour |
|---|---|---|
randomSeed | 0 | 0 chooses an unpredictable seed; non-zero uses that exact seed for the custom LCG. |
Colour and line style
| Parameter | Default | Behaviour |
|---|---|---|
colorScheme | Pitch+Loudness Rainbow | Pitch-height rainbow / pitch-class colour wheel / source-intensity heatmap / octave spiral. |
lineStyle | Thin continuous line | Fixed-width line, source-intensity-dependent line width, or source-intensity-dependent dots. |
minDotSize | 1.0 | Minimum painted-circle size in mm for the Dots style. |
maxDotSize | 4.0 | Maximum painted-circle size in mm for the Dots style. |
Audio synthesis
| Parameter | Default | Behaviour |
|---|---|---|
baseLoudness | 70 | Praat Scale intensity target for the resynthesized Sound, in Praat intensity dB (not dBFS). |
loudnessVariation | 10 | Each phrase receives a random relative-dB offset within ± this value. The same range is also used to map source intensity to visual brightness/width/dot size. |
Display and playback
| Parameter | Default | Behaviour |
|---|---|---|
showGrid | yes | Draws horizontal semitone grid lines; C lines are emphasized. |
showNoteLabels | yes | When the grid is enabled, labels C notes at the left of the main contour. |
playAfterGeneration | yes | Automatically plays the generated Sound after processing. |
800 × 300 hundredths of an inch for the main contour setup; image width and height are not user parameters in the current form.
Audio processing
- The selected Sound is copied as mono, or converted to mono when the source has multiple channels.
- Praat Intensity is calculated with a 75 Hz minimum pitch and 0.01 s time step for visual loudness mapping.
- The grammar constructs a
PitchTierover the Sound's actualstartTime … endTimedomain. - A Manipulation object is created from the mono source with
To Manipulation: 0.01, 75, 600. - The Manipulation pitch tier is replaced by the grammar-generated PitchTier and resynthesized with
Get resynthesis (overlap-add). - If the result is non-silent, Praat
Scale intensitysets its overall target tobaseLoudness. - An
IntensityTierapplies each phrase's random relative-dB offset. A phrase has a constant gain between its start and coda end; values interpolate across the inter-phrase intervals. - A final attenuate-only peak safety is applied: if absolute peak exceeds 0.99,
Scale peak: 0.99is used. Quieter results are not boosted.
Visualization
The visualization is drawn in the Praat Picture window and uses the Sound's true start and end times. Its vertical MIDI range is derived from the current pitch parameters, including the 50 Hz floor and the possible upper gesture/wobble range.
Main contour
The main panel shows the generated grammar pitch points in MIDI-height coordinates. The same points are added to the PitchTier used for resynthesis.
| Colour scheme | Mapping |
|---|---|
| Pitch+Loudness Rainbow | Pitch height maps from blue at the lower display range toward red at the upper range; source intensity controls brightness. |
| PitchClass+Loudness Wheel | Pitch class determines hue; source intensity controls brightness. |
| Intensity Heatmap | Source intensity is mapped across a blue → green → red heat scale. |
| Octave Spiral | Pitch class determines hue; octave and source intensity jointly affect brightness. |
For intensity-dependent line width or dots, the source Intensity value at each generated event is clipped to baseLoudness ± loudnessVariation and mapped to the requested visual range. This visual mapping does not display the generated phrase-level output gain.
Extended panels
- Phrase structure: coloured onset, nucleus, and coda bands, with gesture names shown when there is enough horizontal space.
- Output waveform: the final mono PSOLA result, auto-scaled to its own peak.
- Source intensity: measured source Intensity curve; the dashed line marks
baseLoudness. - Statistics: preset, phrase/point counts, MIDI range, seed, grammar parameters, loudness settings, and counts of all six terminal types.
- Summary strip: identifies the grammar-contour, phrase-structure, and intensity-dynamics view.
Output and reproducibility
- Output object:
<source_name>_grammar. - Channels: mono.
- Time domain: generated over the source Sound's actual start and end times; no DurationTier is used.
- Final level: base intensity target plus phrase-level relative-dB dynamics, followed by an attenuate-only 0.99 peak safety.
- Temporary objects: Manipulation, working mono copy, PitchTier, IntensityTier, and analysis Intensity objects are removed; the generated Sound remains selected.
The Info window reports the actual seed. Reusing a non-zero seed preserves the sequence of grammar choices and phrase dynamics as long as the source duration and relevant grammar/audio parameters are unchanged. Visual style settings do not consume random draws, so changing colour or line style does not change the generated audio contour.