Random Walk Rhythm — User Guide
A deterministic metric pulse grid whose event frequency follows a bounded random walk on a linear-Hz lattice. Each transition requests up, down, or hold; outward requests at the lattice edges are reflected inward. Every event is rendered as a local-phase decaying sinusoidal pulse, then mapped through one of four spatial modes.
Scope
Random Walk Rhythm separates timing from pitch-state evolution:
The rhythm itself is not random. Event onsets occur on a regular metric lattice. The stochastic process controls only which frequency state is assigned to each grid event.
The frequency states are equally spaced in Hz, not in semitones or logarithmic pitch distance.
Quick start
- Run
Random_Walk_Rhythm.praat. No input Sound is required. - Choose Custom or one of the eight presets.
- Set Duration, Tempo, Steps per beat, Base frequency, Frequency step, Probability up/down, and Spatial mode.
- Enable Edit details to set Sample rate, frequency bounds, Event fill, Decay rate, Rotation speed, Output peak, and Random seed.
- Run the script. The random-walk state sequence is generated first, then the complete event stream is synthesized and spatialized.
Deterministic timing grid
Tempo and Steps per beat determine the exact grid spacing:
The number of events is:
The final step may therefore begin before the requested end time but have less than one complete grid step remaining. The event itself is clipped to the remaining output duration.
There are no random onset offsets, no swing, and no tempo drift.
Event fill
Each event occupies:
Because Event fill is restricted to 0 < fill ≤ 1, one event never extends past the onset of the following grid event. Thus there is no intentional event overlap within the mono source stream.
Random walk on a linear-Hz lattice
The base state has index 0 and frequency Base frequency. Reachable neighboring states are spaced by the selected Frequency step:
The usable integer-index range is derived from Minimum frequency, Maximum frequency, Base frequency, and Frequency step. The resulting lattice can begin slightly above the requested minimum or end slightly below the requested maximum because only exact integer steps around the base are retained.
Categorical transition rule
At every transition, one random number determines the requested direction:
The two user probabilities must each lie between 0 and 1, and their sum cannot exceed 1.
An up or down request changes the state by exactly one frequency lattice step. There are no multi-step jumps.
Boundary reflection
The walk does not clamp an illegal move to the edge state.
If an up request occurs at the highest lattice index, it is applied as one step downward. If a down request occurs at the lowest lattice index, it is applied as one step upward.
The script counts these events as boundary reflections. This prevents an outward random request from becoming an artificial repeated edge state.
A genuine hold occurs only when the categorical draw selects the hold category.
Percussive event kernel
Each grid event is a sine oscillator with local phase, exponential decay, and a cosine closure:
where D is the realized event duration.
Local phase
The carrier uses τ, so phase restarts at zero for every event. Consecutive events are therefore separate pulses even if the random walk holds the same frequency state.
Envelope
The exponential term creates the percussive decay. The cosine term begins at 1 and reaches zero at the event boundary, ensuring a zero-valued closure at the end of a complete pulse.
The final event is shortened when necessary so the output ends exactly at Duration.
For implementation stability, synthesis is accumulated in chunks of 20 events. Chunking does not alter the timing or random-walk sequence.
Spatial modes
Mono
The synthesized pulse stream remains mono without additional spatial processing.
Stereo Ping-Pong
Complete events alternate between channels:
Because Event fill never exceeds one grid step, this grid-index routing does not split overlapping events.
Rotating Panorama
The same mono pulse stream is distributed with a continuous constant-power pan trajectory.
The rotation rate is:
A value of 0.5 cycles per beat therefore completes one L→R→L excursion every two beats.
Dual-Band AM
This mode starts from the same mono pulse stream, creates two copies, filters them differently, and applies slow independent amplitude modulation:
| Channel | Band | Gain modulation |
|---|---|---|
| Left | 80 Hz to min(2500 Hz, 90% Nyquist) | 0.8 + 0.1 sin(2π × 0.3t) |
| Right | 120 Hz to min(4000 Hz, 90% Nyquist) | 0.7 + 0.2 cos(2π × 0.4t) |
Controls
Main page
| Control | Default | Behavior |
|---|---|---|
| Preset | Custom | Custom plus eight timing/frequency-walk configurations. |
| Duration | 6 s | Requested final Sound duration. |
| Tempo | 120 BPM | Defines beat duration. |
| Steps per beat | 4 | Subdivides each beat into the event grid. |
| Base frequency | 180 Hz | Frequency of random-walk index 0. |
| Frequency step | 50 Hz | Linear frequency change for every applied up/down transition. |
| Probability up | .40 | Probability of requesting a +1 step. |
| Probability down | .40 | Probability of requesting a -1 step. |
| Spatial mode | Mono | Mono, Ping-Pong, Rotating Panorama, or Dual-Band AM. |
| Edit details | off | Opens synthesis/safety/reproducibility controls. |
Details page
| Control | Default | Behavior |
|---|---|---|
| Sample rate | 44100 Hz | Direct synthesis and final output rate; minimum 1000 Hz. |
| Minimum frequency | 80 Hz | Lower requested limit used to construct the reachable frequency lattice. |
| Maximum frequency | 1500 Hz | Upper requested limit used to construct the reachable frequency lattice. |
| Event fill | .80 | Fraction of each grid step occupied by its event; >0…1. |
| Exponential decay rate | 15 | Controls decay inside each event kernel. |
| Rotation cycles per beat | .50 | Used only by Rotating Panorama. |
| Output peak | .90 | Final target peak normalization; >0…1. |
| Random seed | 0 | 0 = unpredictable; positive = reproducible walk. |
Presets
Presets override Tempo, Steps per beat, Base frequency, Frequency step, Probability up, and Probability down. Duration, Spatial mode, and Details-page controls remain user-controlled.
| Preset | Tempo | Steps/beat | Base / step | Up / down / hold |
|---|---|---|---|---|
| Gentle Bounce | 90 | 2 | 150 / 30 Hz | .50 / .30 / .20 |
| Chaotic Dance | 160 | 8 | 200 / 80 Hz | .40 / .40 / .20 |
| Steady Climb | 100 | 4 | 120 / 40 Hz | .60 / .20 / .20 |
| Falling Steps | 80 | 4 | 200 / 60 Hz | .30 / .50 / .20 |
| Pulsing Heart | 60 | 2 | 100 / 20 Hz | .40 / .40 / .20 |
| Nervous Ticks | 140 | 16 | 180 / 100 Hz | .45 / .45 / .10 |
| Ocean Waves | 70 | 3 | 130 / 25 Hz | .50 / .30 / .20 |
| Machine Pulse | 110 | 4 | 160 / 35 Hz | .40 / .40 / .20 |
Safety and derived limits
Frequency lattice
The base frequency must lie inside the requested min/max bounds. The Frequency step must allow at least two reachable integer lattice states.
The highest reachable lattice frequency must remain below:
The scale is not compressed or rescaled automatically. Unsafe settings stop with an error.
Minimum event resolution
The nominal Event duration must contain at least eight samples at the selected sample rate.
Runtime guard
Version 0.4.1 limits the metric grid to:
If Duration, Tempo, and Steps per beat would create more than 12,000 grid events, the script stops before allocating the event arrays or beginning synthesis.
Randomness and reproducibility
The random walk uses one categorical draw per transition. Timing, event-envelope shape, spatial formulas, and level normalization are deterministic.
Random seed = 0 uses Praat's unpredictable random state. A positive seed makes the requested direction sequence reproducible.
After a fixed-seed walk is complete, the script restores Praat's global RNG to an unpredictable state.
Output and level
| Property | Behavior |
|---|---|
| Input | No input Sound required. |
| Duration | Exactly the requested Duration. |
| Sample rate | Exactly the Details-page Sample rate. |
| Channels | Mono in Mono mode; stereo in Ping-Pong, Rotating Panorama, and Dual-Band AM. |
| Event overlap | None intentionally because Event fill ≤ 1. |
| Global fade | None; every event already has a smooth local closure. |
| Normalization | Every non-silent result is peak-scaled once to Output peak. This is target normalization, not a down-only ceiling. |
| Object names | walk_rhythm_<preset>, with _pingpong, _rotating, or _dualband added for the three stereo modes. |
Visualization and QC
The visualization explains the generating mechanism first and shows the measured waveform only at the end.
| Panel | What it shows |
|---|---|
| A — Walk decisions | Requested up/down/hold directions and the opposite applied step when a boundary request is reflected. |
| B — Frequency state | The realized piecewise-constant frequency trajectory inside the bounded linear-Hz lattice, with the base-frequency reference. |
| C — Event timing/kernel and spatial mapping | Left: one grid step, active event interval, and analytical decay/closure envelope. Right: the gain structure of the selected spatial mode. |
| D — Measured output | Final mono waveform or separate left/right stereo waveforms after spatial processing and target normalization. |
The QC bar reports Tempo, step duration, Event fill, event count, target and realized requested up/down/hold probabilities, reflection count, lattice range, realized frequency range, event duration, Decay rate, local-phase status, spatial mode, and final peak/RMS.