Praat AudioTools / Compositional sound processing

Rhythmatist

A rhythmic composition system that cuts a recording according to mathematical time-series, reorganizes its events, and changes their playback speeds. Speed affects both duration and pitch, so the resulting timeline becomes a new temporal composition, not simply a shuffled copy of the source.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 3.0 (2026) License: MIT Repository: Praat AudioTools on GitHub

The compositional idea

Rhythmatist treats a recording as material for a composition built from three independent but interacting decisions: where to divide the recording, in what order to place the resulting events, and how fast to play each one. A rhythmic structure can therefore emerge from the interplay of mathematical durations, event order, and changes in playback speed.

1

Segmentation

Choose one of five mathematical series to establish event boundaries in the source recording.

2

Organization

Keep, reverse, rotate, sort, alternate, or shuffle the extracted events.

3

Speed

Apply a trajectory of tape-style playback speeds to events in their new output order.

Selected Sound
   → mathematical boundaries (Su / Sc / Sy / Sd / SRC)
   → optional BPM grid and safe cuts
   → organization of source segments
   → speed trajectory + duration relationship
   → natural varispeed (or optional fixed-slot playback)
   → optional gaps, edge fades and stereo placement
   → newly assembled Sound + timeline visualization
What makes this different from ordinary shuffling? With Natural Varispeed, a source event lasting 1 second at 2× speed occupies approximately 0.5 seconds in the result; at 0.5× speed it occupies approximately 2 seconds. Speed creates a new rhythm and changes pitch at the same time.

Quick start

  1. Select exactly one Sound object in Praat.
  2. Run Rhythmatist.praat.
  3. Choose a compositional Preset, or choose Custom to control the three stages independently.
  4. For Custom, select a Series_type and enter five values into Params_a_b_c_d_e, separated by spaces.
  5. Select an Organization and Speed_trajectory. Set Speed_min, Speed_max and, optionally, Duration_link.
  6. Keep Playback = Natural varispeed to allow the composition to change duration organically. Use Target_duration = 0 for a freely determined output length.
  7. Optionally set gaps, fades, safe cuts, BPM snapping, stereo placement and a random seed. Run the script and listen to the created <source>_rhythmatist Sound.
Presets are complete rhythmic behaviors, but not global overrides. They set segmentation, ordering, speed trajectory/range, duration link and gap mode/value. They do not change playback mode, target duration, BPM, stereo placement, random seed, safe cuts, edge fades, or visualization/playback switches.

A useful first comparison: Run Original Pulse as a reference, then run Accelerando, Rhythmic Arch, and Long-Short Dialogue on the same source. These examples explore different connections between event structure and speed.

Eight compositional presets + Custom

The presets are intended to represent different ideas of rhythmic form, rather than minor variations in numerical settings. They can be used as finished procedures or as points of departure for listening and further experimentation.

PresetSegmentation & organizationSpeed behaviorMusical character
Original PulseSu 8; original orderConstant 1×; no gapEight equal source divisions without speed transformation. A reference against which to hear changes.
AccelerandoSu 16; original orderAcceleration, 0.6–2.2×Increasing playback speed and shorter resulting events toward the end.
RitardandoSu 12; original orderDeceleration, 0.45–1.6×; 15% proportional gapProgressive temporal expansion, with space between events.
Rhythmic ArchSc 3+5; original orderArch, 0.6–2.4×A speed climax near the middle, followed by relaxation.
Long-Short DialogueSd 10; long-short alternationAlternating, 0.6–1.8×; duration link −0.4; 40 ms gapContrasting event lengths and speed responses, structured as a dialogue.
Fractured TimeSy 14; random shuffleRandom controlled, 0.4–2.5×; duration link −0.6Irregular divisions and strong local temporal contrasts.
Controlled ChaosSRC (4,3,5,6,5); grouped shuffleWave, 0.5–2×; duration link +0.3; 10% gapDense yet locally organized irregularity, shaped by a cyclic speed pattern.
Dense StrataSRC (6,4,7,8,6); random shuffleConstant speed trajectory, 1.4–2.4×; duration link +0.4Many relatively short events, shaped further by duration-dependent speed.
About “Strata”: the SRC system merges the split points of several series into a single segmentation. It does not synthesize multiple simultaneous audio layers. Here, density refers to the number and spacing of resulting events.

The speed ranges above describe each preset before any optional target-duration adjustment. Speed choices may be restricted by the allowed range when Duration_link is active.

Five mathematical segmentation systems

Each series creates internal split points on a normalized time axis from 0 to 1. The points are mapped onto the source Sound and converted to event boundaries. The resulting segment count may change after deduplication, BPM snapping, safe cuts or sample-level sanitation.

Su — Uniform Regular

Param_a = n. Divides the source into n equal durations.

boundaries = k/n, k = 1…n−1

Sc — Regular Compound

Param_a = a, Param_b = b. Combines two regular grids and removes duplicate points.

{k/a} ∪ {k/b}, internal k only

Sy — Irregular Cumulative

Param_a = n. Generates and sorts n−1 independent random internal split positions, yielding up to n segments.

Sd — Irregular Individual

Param_a = n. Generates n random positive duration weights, normalizes them to sum to 1 and accumulates them into split points.

SRC — Combined series

Merges and deduplicates boundaries from Su, Sc, Sy and Sd. This creates a richer single segmentation grid, not simultaneous layers. The five parameter values are mapped as follows:

Position in Params_a_b_c_d_eMeaning for SRC
aSu segment count
bSc first grid
cSc second grid
dSy segment count
eSd segment count

For Su, Sy and Sd only a is used. For Sc, a and b are used. The script accepts at most 2,000 requested internal points before deduplication.

Temporal organization

Once the source is divided, the organization stage maps output position → original segment. Speed is calculated afterward, using the new positions.

ModeWhat happens
Original orderMaintains the sequence of source segments.
Random shuffleFisher–Yates permutation of all segments.
ReverseReverses event order (not the audio samples inside each event).
RotationCyclically shifts the order by approximately one-third of the segment count.
Long-short alternationUses longest, shortest, second-longest, second-shortest, and so on.
Short to longArranges events in ascending original duration.
Long to shortArranges events in descending original duration.
Grouped shuffleShuffles within neighboring groups of roughly √N segments; group order is retained.

Sorting modes use original source-segment durations. Speed processing can subsequently change the audible lengths, so the final event-duration pattern may differ.

Speed composition

Natural Varispeed: speed changes time and pitch

Rhythmatist uses tape-style varispeed. It reinterprets the segment's sampling frequency and resamples at the source rate. Thus a higher speed produces a shorter, higher-pitched event; a lower speed produces a longer, lower-pitched event. It is not pitch-preserving time-stretching.

Processed event duration ≈ source event duration / playback speed

Seven speed trajectories

Speed_trajectoryPlayback-speed pattern across output events
ConstantThe geometric center of the allowed speed range for every event, before Duration_link. Equal minimum and maximum give an exact constant speed.
AccelerationProgressively increases speed from minimum toward maximum.
DecelerationProgressively decreases speed from maximum toward minimum.
ArchStarts slowly, reaches a speed maximum near the center, and returns toward the minimum.
AlternatingAlternates slow and fast speed ratios between successive events.
WaveUses two cyclic waves across the output sequence.
Random controlledUses a bounded random walk, creating related neighboring speeds rather than unrelated random values.

Speed is interpolated on a logarithmic scale, creating balanced multiplicative changes in playback rate. A trajectory is assigned by output position, even when the source events have been reordered.

Duration_link: connect source length to speed

This parameter ranges from −1 to +1 and modifies the speed trajectory according to each event's original length relative to a geometric reference duration.

log(speed) += Duration_link × log(original_duration / reference_duration)
ValueMeaning
0Speed is independent of the original event duration.
PositiveLonger source events tend to play faster.
NegativeLonger source events tend to play slower, reinforcing differences in duration.
Close to +1Can strongly equalize resulting event lengths, particularly with a constant trajectory and without speed limiting.

Final speed ratios are limited to Speed_min…Speed_max. The script warns when the magnitude of Duration_link is at least 0.8. The allowed speed range is 0.1× to 8×, with Speed_min ≤ Speed_max.

Playback modes

Natural varispeed (default)

The timeline follows the actual processed durations. Faster events become shorter; slower events become longer. No silence is inserted merely to restore a source event's original duration.

Fixed-slot varispeed

Each event occupies its original duration as a slot. Shorter playback leaves silence in the slot; longer playback is cut at the slot boundary. Choose this when a fixed temporal grid is part of the intended composition.

Composition duration

Target_duration_(s,_0_=_free) controls the length of a result made with Natural Varispeed.

Target duration is a global compositional constraint, not an instruction to force every event back to its original length. Sample rounding may cause small differences between requested and measured duration.

Gaps, fades and safe cuts

ControlChoicesPurpose
GapNone / Fixed (ms) / Proportional (% of event)Places intentional silence between events, never after the last event. The proportional mode uses each processed event's audible length.
Gap_valueNon-negative number; default 50Milliseconds in Fixed mode, percent in Proportional mode; ignored for None.
Edge_fade0–50 ms; default 2 msApplies raised-cosine fades at the beginning and end of each event inside its duration. 0 retains hard, sharp boundaries.
Safe_cutsOff / On; default OffAdjusts proposed mathematical boundaries toward a locally quiet point and, when nearby, a zero crossing.

Safe Cuts: the search is within at most ±15 ms of the mathematical boundary (at most ±5 ms when BPM snapping is enabled), further limited by neighboring boundaries. This reduces the likelihood of clicks but can shift exact mathematical positions slightly.

The script uses contiguous placement without crossfades between events. Fades occur within events and do not lengthen the composition. In fixed-slot mode, silence inserted inside a slot is distinct from any additional inter-event gap.

Optional BPM grid

With Bpm_value = 0, mathematical boundaries are used without tempo quantization. With a positive value, Rhythmatist snaps boundaries to a grid defined by BPM and Grid_division. This is not beat or onset detection.

beat duration = 60 / BPM  ;   grid interval = beat duration / units per beat
Grid divisionUnits per beat
Quarter notes1
Eighth notes2
Triplet eighths3
Sixteenth notes (default)4
Triplet sixteenths6

The private processing copy may be shortened to fit an exact whole number of grid units; the original Sound remains unchanged. Duplicate or out-of-range snapped points are removed, so enabling a coarse grid can reduce the number of segments. Safe Cuts, if enabled, may subsequently move boundaries a few milliseconds away from exact grid locations.

Stereo placement and source identity

Stereo_placement = Off (keep source channels) leaves the source's original channel count intact. When stereo placement is selected, the output is two-channel and its pan behavior follows either the source segment's identity or its new output position, depending on the chosen mode.

Placement modeRule
Off (keep source channels)No new pan assignment. The source channel count is retained through the varispeed process.
Alternate L-R by source segmentAlternates according to source-segment index; the spatial identity follows the original event.
Alternate L-R by output positionAlternates across the new assembled sequence.
Sweep L to R by source segmentPan position is based on the original segment index.
Sweep L to R by output positionCreates a progression across the actual output order.
Cycle 4 positions by output positionCycles through four pan positions across output events.
Random positionsAssigns reproducibly randomized pan positions when a seed is set.

Stereo_width is clamped to 0…1 (default 0.8). A width of 0 centers the pan, but does not turn stereo processing off: use the Off placement mode for that.

Mono input is panned using equal-power gains. For stereo input, the script applies left/right balance to the two original channels rather than folding them to mono. If an input has more than two channels, selecting stereo placement produces a two-channel result based on the first two channels; use Off to keep all source channels.

Parameters and initial defaults

The table describes the initial form values. A named preset changes only the fields specified in the preset description.

Praat form fieldDefaultFunction
PresetCustomCustom settings or one of eight named presets.
Series_typeSuMathematical boundary system.
Params_a_b_c_d_e8 4 5 4 3Five space-separated positive integers mapped according to the series.
OrganizationRandom shuffleHow source events are ordered in the result.
Speed_trajectoryAccelerationSpeed pattern over output positions.
Speed_min / Speed_max0.5× / 2×Allowed playback-speed range; must be within 0.1×–8×.
Duration_link0Correlation between original segment duration and speed; −1…+1.
PlaybackNatural varispeedNatural event durations or fixed-slot placement.
Target_duration0 s0 = free; positive = attempt a global duration target in Natural mode.
Gap / Gap_valueNone / 50Gap mode and numerical gap size (ms or % depending on mode).
Edge_fade2 msBoundary fade inside each event; 0–50 ms.
Safe_cutsOffOptional local boundary refinement.
Bpm_value00 = no grid; positive = quantized boundary positions.
Grid_divisionSixteenth notesGrid resolution when BPM is active.
Stereo_placementOffPreserve channels or place events in stereo.
Stereo_width0.8Maximum pan displacement if placement is enabled.
Random_seed00 = new seed every run; positive integer = reproducible random choices.
Draw_visualizationOnDraw the source, segment map, speed trajectory, result and summary.
Play_resultOnPlay the completed output Sound.

Reading the visualization and Info report

The Praat Picture window is organized as a compositional score of what the script actually assembled.

  1. Source waveform: the processing-source waveform with final split boundaries in red and, when active, the BPM grid.
  2. Segment map: the blue upper row represents source events at their original locations; the orange lower row shows their actual lengths and order in the output. Numbers identify source segments; grey denotes inserted silence, including gaps and fixed-slot padding.
  3. Speed plot: the actual playback speed assigned to each event along the output timeline, displayed on a logarithmic vertical scale.
  4. Result waveform: the completed composition, with left and right channels drawn in different colors when the result has more than one channel.
  5. Summary: preset, segmentation and organization, speed range and duration link, source/output length, gaps, seed, and other processing information.

The Info window provides a separate event-by-event table with output position, source-segment number, original duration, actual speed, processed duration, output start time, pan, gap, and any fixed-slot note.

The orange event lengths follow the processed timeline, not merely the original source-segment lengths. This makes changes in duration visible rather than hiding them as a pitch effect.

Output behavior and practical notes

ItemBehavior
Result name<source>_rhythmatist.
Original SoundUnchanged. Processing uses a private copy; its start time is reset to zero.
Sample rateThe result is resampled to the source sampling frequency.
DurationActual event lengths plus any gaps in Natural mode; source-length slots plus gaps in Fixed-slot mode.
RandomnessSupply a positive Random_seed to repeat random segmentation, ordering, speeds and pan choices. With 0, the generated seed is printed in Info for reuse.
Peak protectionIf the measured absolute peak exceeds 0.99, the final Sound is peak-scaled to 0.99; otherwise its gain is unchanged.
PlaybackOptional, controlled by Play_result.
DependenciesPure Praat; no external Python process or audio files are required by the script.
Creative practice: different presets may serve different parts of a composition. Rhythmatist is not designed to identify one “correct” rhythmic result, but to expose complementary approaches to temporal form: accumulation, expansion, contrast, fragmentation, and density.