Dramaturgical Structure Composer — User Guide
Section-level algorithmic recomposition for fixed-media sound. The script detects structural sections from spectral novelty, classifies their broad texture, reorganizes them with form archetypes, and can add looping, silence, time stretching, transformed recalls, texture-aware crossfades, and a macro tension arc.
What this does
Dramaturgical Structure Composer works at the level of musical form rather than as a continuous audio effect. It first partitions the source into sections, measures each section, constructs a new formal order, optionally inserts structural operations, and then assembles the resulting timeline.
The source material itself remains recognizable in ordinary reordered sections. More substantial changes occur only where an operation explicitly transforms content — principally time stretching and material recall. The overall result can therefore range from a lightly reorganized version of the input to a strongly recomposed structure.
What does “dramaturgical” mean here?
In this tool, dramaturgy means shaping large-scale relationships between sections: accumulation, contrast, recurrence, interruption, return, climax, and release. The script does not claim to infer a narrative meaning from the recording. Instead, it converts measurable properties — loudness, spectral centroid, harmonicity, and section boundaries — into formal decisions.
source analysis → section identities → form archetype → optional operations → output timeline.
Quick start
- Select exactly one Sound object. The input must be at least 20 seconds long.
- Run
Dramaturgical_Structure_Composer.praat. - Set the section-duration range and the relative Novelty_threshold.
- Choose a Strategy: Conservative, Dramatic, or Radical.
- Choose a Reorder_mode: None, Arch, Contrast, Rondo, Narrative, or Random swap.
- Choose Fixed or Texture-aware crossfades and Digital zero or Noise tail silence.
- Enable or disable looping, long silence, time stretching, material recall, and the tension arc.
- Optionally enter a positive Random_seed for a reproducible stochastic run. A value of 0 uses an unpredictable seed.
- Run the script. The result is named
<source>_dramat_<Strategy>_<Reorder>.
Section detection
The current script uses spectral novelty only to create section boundaries. It does not run a separate silence detector.
Novelty curve
A mono analysis copy is converted to a spectrogram up to min(5000 Hz, Nyquist). Every 0.1 seconds, the script samples 100 frequency bins and compares the current frame with the previous one in the log-power domain:
Novelty_threshold therefore operates on a relative 0–1 curve, not on absolute spectral power. A boundary is accepted only at a local novelty maximum above the threshold and only when it is more than Min_section_duration_s from the preceding accepted boundary.
Minimum and maximum duration
A final novelty boundary is removed if it would leave an ending fragment shorter than the minimum duration. Long spans are then split so that the entire source remains covered. The script aims to keep every piece at or below Max_section_duration_s, but the minimum duration wins when the two constraints conflict.
Texture classification
Each detected section is measured on a mono analysis copy. The stored audio section itself remains in the original channel format.
| Feature | Measurement |
|---|---|
| Spectral centroid | Praat Spectrum Get centre of gravity: 2. |
| Harmonicity | To Harmonicity (cc), 75 Hz floor; mean HNR in dB. |
| RMS | Root-mean-square level of the section. |
Classification is hierarchical: the first matching rule wins.
| Class | Rule |
|---|---|
| Tonal | Mean HNR > Harmonicity_threshold_dB (default 5 dB). |
| Quiet | RMS < 12% of the loudest detected section. |
| Bright | Centroid above the effective high threshold. |
| Dark | Centroid below the effective low threshold. |
| Mid | None of the previous rules matched. |
The nominal centroid thresholds are 500 Hz and 3000 Hz, but they are automatically reduced for low sample rates so they remain meaningful below Nyquist.
Texture distance
The Contrast archetype uses a distance that combines category difference, centroid difference, and RMS difference:
categoryDifferent is 0 for the same texture class and 1 for different classes; the numeric texture codes themselves are not treated as a metric.
Form archetypes
None
Keeps the detected sections in their original chronological order. Optional operations may still alter the timeline.
Arch
Sorts sections by RMS, places the loudest section near Arc_peak_position, then places successively quieter sections alternately to the left and right of that peak position. The result is an energy-based arch ordering; it is not a literal mirror of the source.
Contrast
Starts with the section having the lowest spectral centroid. It then greedily chooses the unused section with the greatest texture distance from the previous one.
Rondo
Selects one refrain section using a salience score:
The remaining sections stay in their original relative order as episodes, producing A B A C A D ... A. With N detected sections, the form can contain up to 2N - 1 items before additional operations.
Narrative
Sorts all sections from lowest to highest spectral centroid, then appends one additional copy of the darkest section. The appended return is initially unprocessed; any later stochastic operation is planned separately.
Random swap
Starts from the original order and performs between 1 and floor(formLength/2) random swaps. With a positive Random_seed, the swaps are reproducible.
Structural operations
After the form order is created, each enabled operation type receives at most one probabilistic planning attempt. The Strategy controls those probabilities and parameter ranges.
| Strategy | Loop | Silence | Stretch | Recall | Max operations | Stretch range |
|---|---|---|---|---|---|---|
| Conservative | 0.20 | 0.15 | 0.20 | 0.25 | 3 | 0.7–1.4× |
| Dramatic | 0.40 | 0.35 | 0.40 | 0.40 | 4 | 0.4–2.5× |
| Radical | 0.60 | 0.50 | 0.50 | 0.60 | 4 | 0.25–4.0× |
Loop
A random form position is chosen. The operation is accepted only if that source section lasts between 15 and 60 seconds. The section then appears 2 or 3 times total at that position. Added loop copies are plain copies, even if the original position is also stretched.
Long silence
The insertion point is the highest-RMS form position before the end of the form. Its duration begins at 3 seconds and grows according to the RMS drop into the following section:
The strategy silence range is 2 s, 8 s, or 20 s for Conservative, Dramatic, and Radical respectively.
Time stretch
The script preferentially selects a non-Quiet position and randomly chooses a faster or slower factor from the Strategy range. Praat Manipulation/DurationTier overlap-add resynthesis is applied. Multichannel material is split, each channel receives the same duration factor, and the channels are recombined in their original order.
Material recall
A source position from earlier in the form is chosen and a transformed copy of its underlying section is inserted after a later form position. The recall:
- is multiplied by 0.7;
- is low-pass filtered at 2500 Hz when Recall_lowpass is on;
- has a 35% chance of reversal when Recall_reverse is on.
Noise-tail silence
When Silence_mode = Noise tail from source, the script takes the final 2 seconds of the input, applies a 0–400 Hz Hann-band low-pass filter, scales the template to a 0.02 sample peak, repeats it as needed, trims it to the requested silence duration, and applies short edge fades. This creates a very low-level source-derived floor rather than digital zero.
Crossfades & assembly
The completed timeline is assembled sequentially. In Fixed short mode, the requested crossfade is 30 ms. In Texture-aware mode, the requested duration depends on the adjacent texture pair.
| Joint | Requested crossfade |
|---|---|
| Tonal → Tonal | 1.5 s |
| Tonal → other | 0.8 s |
| other → Tonal | 0.6 s |
| Quiet involved | 0.15 s |
| Bright/Mid → Quiet | 0.01 s |
| Silence → anything | 1.5 s |
| anything → Silence | 0.08 s |
| Mid → Mid | 0.4 s |
| Dark ↔ Bright | 0.05 s |
| Other combinations | 0.3 s |
Every requested crossfade is then limited to 40% of the shorter adjacent item. If the safe overlap is 2 ms or less, or if either item is too short, the script uses a butt concatenation instead.
Tension arc
When enabled, the tension arc is a multiplicative envelope applied to the entire assembled output. It ranges from 0.3 at the ends to 1.0 at the selected peak position:
Arc_exaggeration > 1 makes intermediate values lower and therefore increases the contrast between the edges and the peak. It does not normalize individual sections.
Parameters & defaults
| Parameter | Default | Meaning |
|---|---|---|
| Min_section_duration_s | 8 | Minimum accepted section duration. |
| Max_section_duration_s | 90 | Target maximum section duration; long spans are split. |
| Novelty_threshold | 0.25 | Relative threshold on the peak-normalized novelty curve; clamped to 0–1. |
| Harmonicity_threshold_dB | 5.0 | Mean HNR threshold for the Tonal class. |
| Strategy | Dramatic | Operation probabilities and stretch/silence ranges. |
| Reorder_mode | Contrast | None, Arch, Contrast, Rondo, Narrative, or Random swap. |
| Crossfade_mode | Texture-aware | Fixed 30 ms or texture-pair lookup. |
| Silence_mode | Noise tail from source | Digital zero or source-derived low-level noise floor. |
| Allow_looping | On | Enables stochastic loop planning. |
| Allow_long_silences | On | Enables post-peak silence insertion. |
| Allow_time_stretching | On | Enables one stochastic stretch operation. |
| Allow_material_recall | On | Enables one transformed recall operation. |
| Recall_lowpass | On | Applies the fixed 2500 Hz recall low-pass. |
| Recall_reverse | On | Permits the 35% recall-reversal probability. |
| Apply_tension_arc | On | Applies the macro envelope after assembly. |
| Arc_peak_position | 0.65 | Peak position; internally constrained to 0.01–0.99. |
| Arc_exaggeration | 1.5 | Exponent controlling arc contrast. |
| Random_seed | 0 | 0 = unpredictable; positive = reproducible stochastic choices. |
| Draw_visualization | On | Draws the structural transformation. |
| Play_output | On | Plays the completed result. |
Visualization
The Picture window is organized as Source → Dramaturgical form map → Output → Summary.
- Source: mono display of the input, tinted by detected texture class and marked with section boundaries and section numbers.
- Dramaturgical form map: a normalized source-section row and actual output-timeline row connected by neutral mapping lines. Fill color means texture class only; operations are identified textually as
LOOP,SIL,STR,REC, orREC-R. - Tension arc: shown below the timeline inside the same structural map.
- Output: mono display copy of the final result with actual timeline-item starts marked.
- Summary: strategy, form, section/item counts, operation counts, crossfade mode, silence mode, tension-arc state, duration change, and final peak.
The Source and Output waveform panels use a shared amplitude scale.
Output behavior & limits
- Minimum input duration: 20 s.
- Maximum detected sections: 200.
- Rondo may create nearly twice as many form items as detected sections before structural operations.
- Output channel count matches the input channel count.
- Ordinary sections use rectangular extraction; their edges are handled later by the assembly crossfades.
- Each stretched or recalled item has an individual safety check: if its sample peak exceeds 1.0, it is scaled to 0.99.
- After the tension arc, the final output is again checked only for peaks above 1.0 and attenuated to 0.99 if necessary.
- Quiet outputs are not normalized upward; macro-dynamic differences can therefore remain audible.
- Output name:
<source>_dramat_<Strategy>_<Reorder>.