OM Rhythm Tree Slicer — v0.4 User Guide
Realises a flat OpenMusic-style proportion vector as an exact sample-domain metric grid over a Sound, with notes, rests, six rhythm transformations, three source-material mappings, discontinuity-aware fades, and explicit output-level policies.
What this does
OM Rhythm Tree Slicer reads one flat, measure-level proportion vector such as 1 1 2 -1 1. Positive values are sounding leaves and negative values are rests. The vector fills one measure, and Repetitions repeats that measure after applying the selected transformation.
Metric timing
The actual render is planned in integer samples. Boundaries are obtained by cumulative rounding and the final boundary of every measure is forced to measure_samples, so the planned measure length is exact.
subst-rhythm for one level of nested subdivision. It is not a general parser for parenthesised recursive OpenMusic RT syntax.
- Six transformations: None, reverse-tree, rotate-tree, rotate-props, subst-rhythm, invert-rhythm.
- Three source mappings: Sequential, Proportional, Fixed start.
- Exact rests: negative leaves become multichannel silence with the exact planned sample count.
- Discontinuity-aware fades: by default, contiguous source reads are not faded.
- Multichannel preservation: source channel count and sample rate are retained through slicing and concatenation.
- Explicit level policy: attenuate-only ceiling, normalize-to-peak, or no normalization.
1 1 2 and 2 2 4 create the same grid. A value of 0 is rejected because the slicer does not implement zero-time grace events. Real-valued proportions are accepted as an AudioTools extension; in OpenMusic RT notation, floating-point leaves have tie semantics, whereas this script treats them numerically and reports the difference.
Quick start
- Select exactly one Sound in Praat.
- Run
OM_Rhythm_Tree_Slicer.praat. - Choose Manual or one of the six presets.
- Set tempo, metre and the flat Proportions list.
- Choose a transformation and, where relevant, rotation or substitution settings.
- Choose how source material is assigned with Material_mapping and Material_follows_transform.
- Choose fade and normalization policy, then run the script.
The output is named <source>_OM_RT. It is assembled by concatenating the generated sounding slices, rests and any required zero-padding in final temporal order.
Six presets (+ Manual)
Presets overwrite the score-related fields shown below: metre, proportions, transformation, rotation/substitution values, repetitions and material mapping. They do not change tempo, Material_follows_transform, fade settings, normalization/peak, visualization, or playback settings.
| Preset | Metre | Proportions | Transform | Reps | Mapping |
|---|---|---|---|---|---|
| 4/4 quarters - None | 4/4 | 1 1 1 1 | None | 2 | Sequential |
| 5/4 additive - reverse-tree | 5/4 | 2 1 1 -1 2 1 | reverse-tree | 2 | Sequential |
| 7/8 additive - rotate-tree (progressive) | 7/8 | 2 -1 2 1 1 | rotate-tree, N=2, progressive | 4 | Sequential |
| 4/4 mask - rotate-props | 4/4 | 1 1 -1 1 1 -1 1 1 | rotate-props, N=3, progressive | 4 | Proportional |
| 4/4 nested quintuplet - subst-rhythm | 4/4 | 1 1 -1 1 | leaf 2 → 1 1 1 1 1 | 2 | Sequential |
| 4/4 mask - invert-rhythm | 4/4 | 1 -1 1 1 -1 1 -1 1 | invert-rhythm | 2 | Sequential |
Transformations
None
Leaves remain in their original order.
reverse-tree
Leaf-order retrograde: p'[k] = p[n+1-k]. Each extracted audio slice itself still plays forward; only leaf order and, when enabled, source-window identity are rearranged.
rotate-tree
Circularly shifts complete leaves by Rotation_steps. Magnitude, sign and material identity travel together, so the onset grid changes.
rotate-props
Keeps each output slot's magnitude, so the onset grid is identical to None, while the sign pattern and material identity rotate.
subst-rhythm
Replaces one parent leaf with the proportions in Subst_proportions. Child magnitudes sum to the parent magnitude, so all other measure boundaries remain unchanged. Child signs come from the substitution list.
invert-rhythm
p'[k] = -p[k]. Sounding leaves become rests and rests become sounding leaves; durations stay unchanged.
r uses Rotation_steps × r. Repetition 1 is therefore already rotated by N, repetition 2 by 2N, and so on. Negative rotation values are supported.
Material mapping
The rhythm transformation decides when a leaf occurs. Material mapping decides which part of the source fills a sounding leaf.
Sequential (advance playhead)
The source playhead advances only for sounding leaves; rests do not consume source material. With Material_follows_transform = Off, source consumption follows output order. With it On, source windows are first assigned by each leaf's original identity, then the transformed output rearranges those windows.
Proportional (map to position)
With Material_follows_transform = Off, output position maps proportionally to source position. With it On, each transformed leaf maps to the relative source position of its original pre-transform identity; substitution children subdivide their parent's window.
Fixed start (stutter)
Every sounding leaf starts reading at the beginning of the source. The transform-follow flag has no effect in this mapping.
Material_follows_transform = On can reverse the order of source chunks under reverse-tree, but it does not reverse sample order inside an individual slice. This is rhythmic/material retrograde, not reverse-audio processing.
Timing, extraction and fades
Sample-exact metric plan
Every measure is converted to an integer measureSamples. Leaf boundaries use cumulative rounding, with the final boundary forced to the exact measure length. Every leaf therefore receives an integer target length, and all repetitions remain aligned to the same measure grid.
The script reports requested and achieved sample counts plus drift. Under normal operation drift should be 0; a non-zero value is a diagnostic sign of unexpected behaviour, not an expected cumulative-rounding error.
Source-end policy
- If a normal read would extend beyond the source end, its start position is pulled backward so the whole requested slice fits.
- If one leaf is longer than the entire source, the script uses the whole source once from its beginning and fills the remaining samples with silence.
- Material offsets are wrapped to the source duration before this source-end check, but a slice is never split into an end-of-file segment plus a wrapped beginning segment.
Edge fades
Fade_ms applies a raised-cosine fade with a butt join, not an overlap crossfade. The fade is clamped to half the extracted slice length. With Fade_only_discontinuities = On (default), contiguous reads from the source remain untouched; fades are used at rests, non-contiguous edits, zero-padding boundaries and outer file edges.
Concatenation
Praat concatenates selected Sounds in object-list/creation order. The script therefore creates every temporary piece directly in final temporal order and checks that object IDs are ascending before calling Concatenate. All temporary pieces are removed afterward.
Parameters & defaults
| Parameter | Default | Meaning |
|---|---|---|
| Preset | Manual | Manual settings or one of six complete score recipes. |
| Tempo_BPM | 120 | Quarter-note BPM. The denominator scales the measure duration. |
| Numerator / Denominator | 4 / 4 | Time signature. Non-power-of-two denominators are accepted but reported as unconventional notation. |
| Repetitions | 2 | Number of measure repetitions. |
| Proportions | 1 1 2 -1 1 | Flat signed proportion list; negative = rest; zero rejected. |
| Transformation | None | One of the six transformations described above. |
| Rotation_steps | 1 | Circular shift for rotate-tree / rotate-props; may be negative. |
| Progressive_rotation | Off | Uses N×r on repetition r. |
| Subst_target_leaf | 3 | Parent leaf replaced by subst-rhythm; if above the leaf count it is clamped to the last leaf and reported. |
| Subst_proportions | 1 1 1 | Child proportions for subst-rhythm. |
| Material_mapping | Sequential | Sequential, Proportional, or Fixed start. |
| Material_follows_transform | On | Associates source-window identity with transformed leaves where the mapping supports it. |
| Fade_ms | 8 ms | Raised-cosine edge guard. |
| Fade_only_discontinuities | On | Leaves truly contiguous source joins unfaded. |
| Normalization | Peak ceiling (attenuate only) | Attenuate-only ceiling, Normalize to peak, or Off. |
| Peak_dB | -1.0 dBFS | Target used by the two peak-level policies. Values above 0 dBFS are rejected. |
| Draw_visualization | On | Draws the v0.4 four-panel diagnostic page. |
| Play_result | On | Plays the final Sound. |
- Peak ceiling (attenuate only): reduces level only when the raw peak exceeds
Peak_dB; quieter material is left unchanged. - Normalize to peak: scales any non-silent result so its peak equals
Peak_dB. - Off: applies no final level scaling.
Visualization — v0.4
v0.4 standardizes the page layout but preserves the script-specific transformation display. The figure contains four information regions:
- Input Tree: one measure in proportional units. Blue = sounding leaf; grey = rest; a beat ruler appears below.
- Transformed Tree: the complete output timeline, including all repetitions. Red vertical lines mark measure boundaries.
- Output Waveform: the rendered Sound with grey leaf boundaries and red barlines. The amplitude axis is derived from the measured final peak.
- Summary: transformation, input tree, metre, leaf counts, mapping, fade policy, duration/drift, level policy, channel preservation, and preset information.
The visualization represents the actual planned/rendered structure; it is not a generic explanatory diagram.
Limits and interpretation
- Flat input only: the main Proportions field is not a recursive RT parser.
- subst-rhythm is the nesting mechanism: one target leaf is replaced by one child proportion list.
- No grace-note model: zero proportions are rejected.
- Decimal-token semantic difference: decimals are numeric ratios here, even though OpenMusic uses floating-point leaves for ties.
- No reverse-sample playback: reverse-tree reverses leaf order; individual slices remain forward.
- Output timeline: the concatenated result is a new Sound timeline; the source's absolute start time is used for extraction but is not preserved as an output offset.
- Multichannel material is preserved: rests and filler are created with the same number of channels and sample rate as the source.