Rhythmatist — User Guide

Rhythmic reassembly from mathematically generated segment boundaries. Rhythmatist builds one of five normalized split-point series, optionally snaps those boundaries to a BPM grid, shuffles the resulting source segments, and can assign per-segment varispeed pitch and constant-power stereo positions before hard concatenation.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 2.4 (2026) License: MIT License Repo: GitHub
Contents:

What this does

Rhythmatist creates a new temporal ordering of material already present in one selected Sound. It first generates a set of boundaries on a normalized 0–1 time axis, converts them to seconds, optionally snaps them to a musical pulse grid, extracts the resulting segments, randomizes their order with Fisher–Yates, and concatenates them.

selected Sound → private zero-based processing copy → mathematical boundary series → optional BPM-grid snap → segment extraction → Fisher–Yates permutation → optional per-segment varispeed pitch → optional per-segment stereo pan → hard concatenation
Three features are controlled through numeric “off” conventions rather than separate switches: BPM is active when Bpm_value > 0; pitch is active when Pitch_levels > 1; stereo panning is active when Stereo_width > 0.
With the current form defaults, pitch and stereo are already active: Pitch_levels = 4 and Stereo_width = 0.8. Set Pitch_levels to 1 and Stereo_width to 0 if you want shuffle-only processing.

Quick start

  1. Select exactly one Sound object.
  2. Run Rhythmatist.praat.
  3. Choose Custom or one of the six named series presets.
  4. For Custom, choose Su, Sc, Sy, Sd, or SRC and set the relevant Param_a…Param_e values.
  5. Set Bpm_value = 0 to keep the mathematically generated boundaries unsnapped, or enter a positive BPM to quantize them.
  6. Set Pitch_levels = 1 to disable pitch processing; use more than one level to activate per-segment varispeed transposition.
  7. Set Stereo_width = 0 to disable new stereo panning; use a positive width for stereo placement.
  8. Run the script. The result is named <source>_rhythmatist.
Named presets change only the rhythmic-series definition. BPM, pitch, stereo, visualization and playback settings remain whatever is currently entered in the form.

Five rhythmic series

All series are generated as interior points on a normalized 0–1 axis. After any BPM snap and boundary sanitation, the final number of segments is one more than the number of retained interior boundaries.

Su — Uniform Regular

Param_a = n. Creates n equal segments:

interior boundaries: k / n for k = 1 ... n-1

Sc — Regular Compound

Param_a = a, Param_b = b. Creates the sorted, deduplicated union of the two regular grids:

{k/a | k=1...a-1} ∪ {k/b | k=1...b-1}

The resulting segment count is determined by the unique combined boundaries; it is not simply a+b.

Sy — Irregular Cumulative

Param_a = n. The current v2.4 convention generates exactly n−1 independent uniform random interior split positions, sorts them, and therefore targets n segments before later snapping/sanitation:

u1 ... u(n-1) ~ Uniform(0,1) boundaries = sort(u1 ... u(n-1))
Earlier documentation described n random points. Since v2.3, Sy uses n−1 points directly; this removes the previous “generate n then drop the largest” bias.

Sd — Irregular Individual

Param_a = n. Generates n positive random duration weights, normalizes them by their total, and converts the first n−1 cumulative sums into boundaries:

d[k] ~ Uniform(0,1) w[k] = d[k] / sum(d) boundary[k] = sum(w[1...k]) for k = 1 ... n-1

SRC — Combined strata

The generic parameter mapping is:

ParameterSRC role
Param_aSu segment count
Param_bSc first grid count
Param_cSc second grid count
Param_dSy segment count
Param_eSd segment count

SRC merges:

Su(a) ∪ Sc(b,c) ∪ Sy(d) ∪ Sd(e)

The combined boundaries are sorted, deduplicated, and stripped of points at the exact 0/1 endpoints.

Complexity guard

Before deduplication, the requested number of interior split points may not exceed 5000. This prevents pathological custom settings from creating an excessive number of indexed variables and Praat objects.

Six series presets + Custom

The named presets overwrite only Series_type and the series parameters they need.

PresetSeriesParameters
Simple PulseSun = 8
Binary GridSc2 + 4
Golden SplitSc3 + 5
CloudSyn = 12
FragmentedSdn = 16
Dense StrataSRCSu=3, Sc=2+5, Sy=4, Sd=3
A preset does not reset Bpm_value, Pitch_levels, Pitch_step_semitones, Pitch_assign, Stereo_width or Stereo_mode. For example, choosing Simple Pulse with the default form still uses four pitch levels at 7 semitones per level and stereo width 0.8.

BPM grid snapping

BPM mode is active when Bpm_value > 0. The script does not detect tempo from the audio.

beatSeconds = 60 / Bpm_value gridInterval = beatSeconds / unitsPerBeat
Grid_divisionUnits per quarter-note beat
Quarter notes1
Eighth notes2
Triplet eighths3
Sixteenth notes — default4
Triplet sixteenths6

Grid-duration trim

When possible, the private processing copy is shortened to the largest whole number of grid units that fits inside the source:

nGridUnits = floor(sourceDuration / gridInterval) targetDuration = nGridUnits × gridInterval

The source object itself is never changed. If targetDuration is zero, or the source already ends on a grid unit, no shortening is performed.

Boundary snapping

Every generated boundary is rounded to its nearest grid position:

snapped = round(boundary / gridInterval) × gridInterval

Snapped endpoints and duplicate boundaries are removed. If the available duration contains fewer than two grid units, there is no legal interior grid boundary and the segmentation collapses to one segment.

BPM mode is quantization arithmetic only. It performs no onset, beat, downbeat or meter analysis.

Shuffle

After extraction, the segment-object IDs and their original segment indices are permuted together using Fisher–Yates:

for i = N ... 2: j = randomInteger(1, i) swap(segment[i], segment[j])

The Info window reports the resulting mapping as:

output position i ← original segment j

Because Praat's normal Concatenate ordering depends on object IDs, the script rebuilds the sequence iteratively from the end toward the beginning so the delivered audio follows the stored shuffled array.

There is no random-seed control. Sy, Sd, SRC random strata, Fisher–Yates, Random pitch assignment and Random stereo mode all use Praat's current random stream, so repeated runs can differ.

Per-segment pitch assignment

Pitch processing is active when Pitch_levels > 1.

Level to pitch ratio

semitones = pitchLevel × Pitch_step_semitones ratio = 2^(semitones / 12)

Levels begin at 0. With the default four levels and +7 semitone step, the available shifts are therefore 0, +7, +14 and +21 semitones. A negative Pitch_step_semitones produces downward levels.

Assignment modes

Pitch_assignActual rule
Cycle(originalSegmentIndex−1) mod Pitch_levels
Alternating(originalSegmentIndex−1) mod 2; only levels 0 and 1 are used even when Pitch_levels > 2.
RandomOne random integer from 0 to Pitch_levels−1 for each shuffled segment.
Cycle and Alternating are tied to the segment's original source index, not its new shuffled output position. The transformation therefore travels with source-segment identity through the permutation.

What the pitch processor actually does

Rhythmatist uses varispeed:

Override sampling frequency: round(sourceSR × ratio) then: Resample back to sourceSR

Varispeed naturally changes both pitch and duration. Rhythmatist then forces the transformed segment back to its original pre-transposition duration:

This is not pitch-preserving time compensation, PSOLA, or phase-vocoder pitch shifting. Ratio > 1 produces a shorter/higher varispeed event followed by zero padding; ratio < 1 produces a longer/lower event whose tail is truncated.

Pitch_step_semitones is restricted to −96…+96. The script does not impose an upper bound on Pitch_levels, so extremely large custom level counts can imply impractically extreme ratios.

Per-segment stereo assignment

Stereo processing is active when Stereo_width > 0. Width is clamped to 0…1.

Every processed segment is mono before panning, and the pan law is constant power:

theta = (pan + 1) / 2 × π/2 L = cos(theta) R = sin(theta)

Stereo modes

ModePan rule
Alternating L-Rodd original segment → −width; even original segment → +width
Sweep L to Rlinear pan from −width to +width according to original segment index
Cycle 4-positions−1, −0.33, +0.33, +1 multiplied by width, cycling by original segment index
Randomuniform random value in [−width,+width]

As with deterministic pitch assignment, the non-random spatial pattern follows original segment identity through the shuffle.

Input-channel behavior

If either pitch or stereo processing is active and the selected source has more than one channel, the processing source is first converted to mono.

When mono conversion occurs, the source's original stereo or multichannel image is not preserved.

Assembly, joins & output duration

The final segments are concatenated directly in shuffled order. There is no overlap, fade, crossfade, smoothing envelope or gap inserted at the joins.

Segment boundaries are therefore hard butt joins. Abrupt waveform discontinuities can produce clicks, especially with non-zero crossings or strong low-frequency material.

Duration

Every extracted segment keeps its original segmentation duration, including after pitch processing because the varispeed result is truncated or zero-padded back to that duration. Consequently:

target output duration = sum(final segment durations) ≈ processing duration

Without BPM mode this is the source duration. With BPM mode it is the private grid-trimmed duration when trimming was applicable. Minor sample-grid rounding can affect the exact numerical result.

No final gain stage

Rhythmatist performs no final peak normalization, safety ceiling, limiter or global gain adjustment. Praat Sounds can contain floating-point samples outside ±1; such peaks may require attention before integer-file export.

Parameters & defaults

ParameterDefaultRole
PresetCustomCustom or one of six rhythmic-series presets.
Series_typeSuSu, Sc, Sy, Sd, or SRC.
Param_a8Su/Sy/Sd count; Sc first count; SRC Su count.
Param_b4Sc second count; SRC Sc first count.
Param_c5SRC Sc second count.
Param_d4SRC Sy count.
Param_e3SRC Sd count.
Bpm_value00 = off; positive = grid trim/snap active.
Grid_divisionSixteenth notesQuarter, eighth, triplet eighth, sixteenth, or triplet sixteenth.
Pitch_levels41 = off; more than 1 activates pitch processing.
Pitch_step_semitones7Pitch interval per level; validated −96…+96.
Pitch_assignCycleCycle, Alternating, or Random.
Stereo_width0.80 = off; otherwise clamped to 0…1.
Stereo_modeAlternating L-RAlternating, Sweep, 4-position Cycle, or Random.
Draw_visualizationOnDraw source, boundaries, permutation map and result.
Play_resultOnPlay completed result.

Visualization

The v2.4 Picture view preserves the tool's original segment-order concept while correcting label placement and dense-segmentation readability.

  1. Source waveform: private processing source with final split boundaries. BPM mode also shows grid and beat lines.
  2. Segment-order diagram: blue upper row = original order; orange lower row = actual shuffled order. Numbers are shown only when cells are wide enough.
  3. Result waveform: mono or L/R depending on the actual result channel count.
  4. Footer/legend: series, number of shuffled segments, and active BPM/pitch/stereo settings.

Boundary display

Red source markers show the final boundaries after BPM snapping and one-sample sanitation, not the raw pre-quantization random or mathematical boundaries.

Permutation map

The orange row uses the actual stored segIndex order that produced the output. Its cell widths remain the original segment durations, because pitch processing restores every transformed segment to its original segmentation duration before assembly.

Waveform scales

The Source and Result are drawn separately with Praat's automatic waveform ranges. They are therefore useful for shape/timing inspection but are not a shared-amplitude-scale comparison.

In stereo mode, blue represents the output left channel and orange/red the output right channel. Those colors are separate from the blue/orange semantics used by the original/shuffled order diagram.

Output behavior

The Info window reports the active series, grid information, pitch/stereo setup, every retained split, the final shuffled order, per-segment pitch/pan decisions, and the measured result duration.