Beat Repeat — User Guide
Rhythmic stuttering effect: extracts tempo-synchronized audio segments based on musical note values, creates multiple repeats with exponential amplitude decay, and splices them into the original — mimicking classic glitch/stutter effects from Ableton Live and granular processing techniques.
What this does
This script implements beat repeat — a rhythmic audio effect that extracts tempo-synchronized segments and stutters them with progressive amplitude decay. Core concept: (1) Tempo synchronization: User specifies BPM (beats per minute) to align processing with musical tempo. (2) Note value selection: Choose from 12 rhythmic durations (1/32 through dotted 1/2, including triplets) to determine segment length. (3) Beat selection: Four modes: specific beat number, random beat, beat range, or automatic (1 second in). (4) Segment extraction: Audio segment extracted at calculated time position with precise note duration. (5) Repeat generation: Segment copied multiple times (default 4) with exponential amplitude decay (default 0.9 per repeat). (6) Splicing: Original audio before segment + repeated section + original audio after segment concatenated. Result: Rhythmic stuttering effect perfectly synchronized to tempo, creating glitch textures, rhythmic emphasis, or textural fills. Unlike random stuttering, beat repeat is musically quantized — repeats align with tempo grid.
Key Features:
- Tempo Synchronization — BPM-based timing for musical alignment
- 12 Note Value Options — Standard notes, triplets, and dotted rhythms
- 4 Selection Modes — Specific beat, random, range, or auto
- Exponential Decay — Progressive amplitude reduction (e.g., 0.9^n)
- Optional Crossfading — Smooth fade in/out on repeated segments
- Diagnostic Feedback — RMS levels, warnings, beat calculations
What is beat repeat? Traditional stuttering effects: Manual tape edits (splicing), sampler stutter (hardware limitations), buffer repeats (delay feedback), glitch plugins (granular fragmentation). Beat repeat: Tempo-aware segment repetition with musical quantization. Key differences: (1) Musical timing: Segments aligned to BPM grid, not arbitrary time. (2) Note value precision: Exact rhythmic durations (1/16, 1/8 triplet, etc.). (3) Controlled decay: Exponential amplitude falloff (mimics natural echo decay). (4) Flexible selection: Target specific beats, random positions, or ranges. (5) Splicing workflow: Non-destructive insertion into original audio. Use cases: Electronic music production (glitch beats, fills), DJ effects (beat juggling simulation), experimental composition (rhythmic fragmentation), sound design (textural variation), teaching rhythm (visualizing subdivisions). Popularized by Ableton Live's Beat Repeat device (this script provides similar functionality in Praat).
Technical Implementation: (1) Tempo calculation: secondsPerBeat = 60 / BPM. For 120 BPM: 60/120 = 0.5s per beat. (2) Note duration calculation: Based on note_value selection: Standard notes (1/32, 1/16, 1/8, 1/4, 1/2) = secondsPerBeat / subdivision. Triplets (1/16t, 1/8t, 1/4t) = (secondsPerBeat / subdivision) × (2/3). Dotted notes = standard duration × 1.5. (3) Beat selection: (a) Specific beat: startTime = (beatNumber - 1) × secondsPerBeat. (b) Random beat: randomInteger(2, totalBeats - 1) to avoid edges. (c) Beat range: Extract from rangeStart to rangeEnd beats. (d) Auto: 1 second in (or 25% if duration < 2s). (4) Segment extraction: Extract part: [startTime, startTime + noteDuration]. (5) Repeat generation loop: For i = 1 to num_repeats: Copy segment, apply decay: amplitude × (amplitude_decay)^(i-1), concatenate to repeated section. (6) Optional fade: If fade_repeats enabled: Fade in/out on segment (duration = fade_duration). (7) Final assembly: Concatenate: before (0 to startTime) + repeated section + after (startTime + noteDuration to end). (8) Output: Result named "originalname_beat_repeat", auto-played. Key insight: Exponential decay creates natural-sounding repetition falloff. First repeat full volume, second repeat × 0.9, third × 0.81, fourth × 0.729 — mimics acoustic echo decay. Beat selection modes provide creative flexibility while maintaining tempo sync.
Quick start
- In Praat, select exactly one Sound object (mono or stereo).
- Run script… →
Beat_Repeat.praat.
- Set bpm to match your audio's tempo (e.g., 120, 140, 90).
- Choose note_value: 1/16 (fast stutter) or 1/8 (medium stutter) recommended for glitch effects.
- Select beat_selection_mode: Auto (easiest), Specific beat, Random, or Beat range.
- Adjust num_repeats (4 default) and amplitude_decay (0.9 default).
- For smooth repeats, enable fade_repeats (optional).
- Click OK — processing begins, output auto-plays.
Quick tip: For classic glitch stutter: Use 1/16 or 1/8 note, 4-8 repeats, decay 0.85-0.95. For subtle textural fill: Use 1/32 note, 8-16 repeats, decay 0.9-0.95. For dramatic breakdown: Use 1/4 or 1/8 triplet, 3-5 repeats, decay 0.7-0.8. BPM accuracy critical: If you don't know exact BPM, use tempo detection software first, or tap tempo manually (count beats for 30s, multiply by 2). Beat selection: Auto mode safe for quick results. Specific beat mode for precise control (e.g., target downbeat of bar 2 = beat 5 at 4/4). Random mode for generative variation. Fade repeats recommended for smoother results, though some glitch aesthetics prefer hard transients. Script prints diagnostic info to Info window (segment RMS, beat calculations) — useful for troubleshooting quiet segments.
Important: REQUIRES ACCURATE BPM — incorrect tempo misaligns repeats (not on beat grid). If audio has tempo changes, this script assumes constant tempo — only suitable for steady BPM material. MONO/STEREO PRESERVED — script maintains channel count (stereo input → stereo output). SEGMENT RMS CHECK — if selected segment is silent/quiet (RMS < 0.0001), script warns to choose different beat. Check Info window for warnings. BOUNDARY HANDLING — if selected beat + note duration exceeds audio duration, script adjusts startTime to fit segment within bounds. OUTPUT DURATION — result is longer than original: original_duration + (noteDuration × num_repeats) - noteDuration. Example: 10s audio, 0.125s segment, 4 repeats → 10 + (0.125 × 4) - 0.125 = 10.375s. DESTRUCTIVE SPLICING — replaces original segment with repeated section. Original audio before/after segment preserved. Not suitable if you need to preserve every note (use on fills, transitions, or textural sections).
Beat & Rhythm Theory
Tempo and Beat Calculation
BPM to Time Conversion
Fundamental relationship:
Beats Per Minute (BPM) to seconds per beat:
secondsPerBeat = 60 / BPM
Examples:
BPM = 60 → secondsPerBeat = 60/60 = 1.000s (one beat per second)
BPM = 120 → secondsPerBeat = 60/120 = 0.500s (two beats per second)
BPM = 140 → secondsPerBeat = 60/140 = 0.429s (typical uptempo house)
BPM = 90 → secondsPerBeat = 60/90 = 0.667s (slower hip-hop tempo)
BPM = 170 → secondsPerBeat = 60/170 = 0.353s (drum & bass)
Total beats in audio:
totalBeats = floor(duration / secondsPerBeat)
Example (10s audio at 120 BPM):
totalBeats = floor(10 / 0.5) = 20 beats
Beat start times (0-indexed):
beat_1_start = 0 × secondsPerBeat = 0.000s
beat_2_start = 1 × secondsPerBeat = 0.500s
beat_3_start = 2 × secondsPerBeat = 1.000s
beat_4_start = 3 × secondsPerBeat = 1.500s
...
1-indexed (script convention):
beat_N_start = (N - 1) × secondsPerBeat
Note Value Calculations
Standard Note Durations
Basic subdivisions:
Standard notes (relative to quarter note = 1 beat in 4/4 time):
1/32 note (thirty-second):
duration = secondsPerBeat / 8
Example (120 BPM): 0.5 / 8 = 0.0625s = 62.5ms
1/16 note (sixteenth):
duration = secondsPerBeat / 4
Example (120 BPM): 0.5 / 4 = 0.125s = 125ms
1/8 note (eighth):
duration = secondsPerBeat / 2
Example (120 BPM): 0.5 / 2 = 0.25s = 250ms
1/4 note (quarter):
duration = secondsPerBeat
Example (120 BPM): 0.5s = 500ms
1/2 note (half):
duration = secondsPerBeat × 2
Example (120 BPM): 0.5 × 2 = 1.0s
Relationship:
Each division is half the duration of the previous
1/32 → 1/16 → 1/8 → 1/4 → 1/2 (each ×2)
Triplet Note Durations
Ternary subdivisions:
Triplets (three notes in the space of two standard notes):
Formula: (standard_duration) × (2/3)
1/16 triplet (sixteenth triplet):
duration = (secondsPerBeat / 4) × (2/3)
Example (120 BPM): (0.5 / 4) × (2/3) = 0.125 × 0.667 = 0.0833s
1/8 triplet (eighth triplet):
duration = (secondsPerBeat / 2) × (2/3)
Example (120 BPM): (0.5 / 2) × (2/3) = 0.25 × 0.667 = 0.1667s
1/4 triplet (quarter triplet):
duration = secondsPerBeat × (2/3)
Example (120 BPM): 0.5 × (2/3) = 0.3333s
Musical interpretation:
Triplet feel: "tri-pl-et" — three equal notes per beat
Swing feel approximated by triplets (long-short = 2:1 ratio)
Common in jazz, shuffle rhythms, hip-hop
Dotted Note Durations
Extended durations:
Dotted notes (add 50% to standard duration):
Formula: (standard_duration) × 1.5
Dotted 1/16:
duration = (secondsPerBeat / 4) × 1.5
Example (120 BPM): 0.125 × 1.5 = 0.1875s
Dotted 1/8:
duration = (secondsPerBeat / 2) × 1.5
Example (120 BPM): 0.25 × 1.5 = 0.375s
Dotted 1/4 (dotted quarter):
duration = secondsPerBeat × 1.5
Example (120 BPM): 0.5 × 1.5 = 0.75s
Dotted 1/2 (dotted half):
duration = (secondsPerBeat × 2) × 1.5
Example (120 BPM): 1.0 × 1.5 = 1.5s
Musical interpretation:
Dotted rhythms create syncopation
Common in compound meters (6/8, 9/8, 12/8)
Creates "long-short" feel
Amplitude Decay Mathematics
Exponential Decay Formula
Repeat amplitude calculation:
Exponential decay: amplitude_n = amplitude_0 × (decay_factor)^(n-1)
Where:
amplitude_0 = initial amplitude (1.0 = full volume)
decay_factor = amplitude_decay parameter (e.g., 0.9)
n = repeat number (1, 2, 3, ...)
amplitude_n = amplitude of repeat n
Example (amplitude_decay = 0.9, 6 repeats):
Repeat 1: 1.0 × 0.9^0 = 1.0 × 1.000 = 1.000 (100% volume)
Repeat 2: 1.0 × 0.9^1 = 1.0 × 0.900 = 0.900 (90% volume)
Repeat 3: 1.0 × 0.9^2 = 1.0 × 0.810 = 0.810 (81% volume)
Repeat 4: 1.0 × 0.9^3 = 1.0 × 0.729 = 0.729 (73% volume)
Repeat 5: 1.0 × 0.9^4 = 1.0 × 0.656 = 0.656 (66% volume)
Repeat 6: 1.0 × 0.9^5 = 1.0 × 0.590 = 0.590 (59% volume)
Decay comparison (4 repeats):
decay = 0.95: [100%, 95%, 90%, 86%] — subtle decay
decay = 0.90: [100%, 90%, 81%, 73%] — balanced decay
decay = 0.85: [100%, 85%, 72%, 61%] — medium decay
decay = 0.80: [100%, 80%, 64%, 51%] — aggressive decay
decay = 0.70: [100%, 70%, 49%, 34%] — dramatic decay
Why exponential?
Mimics natural acoustic decay (echoes, reverb tails)
Perceptually smooth (logarithmic hearing perception)
Each repeat reduced by constant percentage
Cumulative Energy Calculation
Total energy of repeated section:
Sum of geometric series:
total_energy = Σ(n=1 to N) decay^(n-1)
= (1 - decay^N) / (1 - decay)
Example (decay = 0.9, 4 repeats):
total_energy = (1 - 0.9^4) / (1 - 0.9)
= (1 - 0.6561) / 0.1
= 0.3439 / 0.1
= 3.439
Interpretation:
Repeated section energy ≈ 3.44× original segment energy
Useful for estimating output levels
High decay + many repeats = loud repeated section
Practical examples (4 repeats):
decay = 0.95 → total_energy = 3.717
decay = 0.90 → total_energy = 3.439
decay = 0.85 → total_energy = 3.176
decay = 0.80 → total_energy = 2.936
decay = 0.70 → total_energy = 2.560
Infinite series limit (N → ∞):
total_energy = 1 / (1 - decay)
For decay = 0.9: limit = 1 / 0.1 = 10
(theoretical maximum if infinite repeats)
Beat Selection Modes
Mode 1: Specific Beat Number
Description: Extract segment starting at a user-specified beat number
Parameters:
- specific_beat: Beat number to target (1-indexed)
Calculation:
startTime = (specific_beat - 1) × secondsPerBeat
Boundary handling:
- If specific_beat < 1: Use beat 1
- If specific_beat > totalBeats: Use last beat
Example (120 BPM, 10s audio, beat #5):
secondsPerBeat = 0.5s
totalBeats = 20
startTime = (5 - 1) × 0.5 = 2.0s
Extract segment at 2.0s
Use cases:
- Precise rhythmic placement (target specific downbeat)
- Musical composition (repeat bar 3 beat 2)
- Consistent results (same beat every time)
- Manual control for specific musical moments
Musical examples:
- Beat 1 = Downbeat of bar 1 (strong)
- Beat 5 = Downbeat of bar 2 in 4/4 time
- Beat 9 = Downbeat of bar 3 in 4/4 time
Mode 2: Random Beat
Description: Randomly select a beat from the available range (excludes first and last beat)
Calculation:
selectedBeat = randomInteger(2, totalBeats - 1)
startTime = (selectedBeat - 1) × secondsPerBeat
Boundary handling:
- Avoids beat 1 (often has intro/attack)
- Avoids last beat (may be truncated)
- If totalBeats ≤ 2: Use beat 1
Example (120 BPM, 10s audio):
totalBeats = 20
Random range: beats 2-19
Possible selection: beat 12
startTime = (12 - 1) × 0.5 = 5.5s
Use cases:
- Generative music (variation on each run)
- Exploratory sound design (try different positions)
- Live performance preparation (create variations)
- A/B testing different segment positions
Variation:
Run script multiple times → different beat each time
Creates a set of variations from single source
Useful for choosing "best sounding" repeat
Mode 3: Beat Range
Description: Replace an entire range of beats with the repeated section
Parameters:
- beat_range_start: First beat to replace (inclusive)
- beat_range_end: Last beat to replace (inclusive)
Calculation:
rangeLength = (rangeEnd - rangeStart + 1) × secondsPerBeat
startTime = (rangeStart - 1) × secondsPerBeat
afterStart = startTime + rangeLength
Boundary handling:
- If rangeStart < 1: Use 1
- If rangeEnd > totalBeats: Use totalBeats
- If rangeStart > rangeEnd: Swap them
Example (120 BPM, beats 3-6):
secondsPerBeat = 0.5s
rangeStart = 3, rangeEnd = 6
startTime = (3 - 1) × 0.5 = 1.0s
rangeLength = (6 - 3 + 1) × 0.5 = 2.0s
Replace 2.0s section with repeated segment
Use cases:
- Fill an entire musical phrase (replace bars 2-3)
- Create extended stutter sections
- Build transitions (replace 4 beats before drop)
- Textural replacement (swap section with glitch)
Musical application:
In 4/4 time (4 beats per bar):
- Beats 1-4: Replace entire bar 1
- Beats 5-8: Replace entire bar 2
- Beats 3-6: Replace beat 3 of bar 1 through beat 2 of bar 2
Mode 4: Auto (1 Second In)
Description: Automatically select segment at 1 second into audio (or 25% if audio < 2s)
Calculation:
if duration ≥ 2.0s:
startTime = 1.0s
else:
startTime = duration × 0.25
selectedBeat = floor(startTime / secondsPerBeat) + 1
Rationale:
- Avoids very beginning (often intro/silence/attack)
- Gives audio time to establish groove
- Safe default for most material
- No user input required (quick workflow)
Example (120 BPM, 10s audio):
startTime = 1.0s (fixed)
selectedBeat = floor(1.0 / 0.5) + 1 = 3
Extract segment at beat 3 (1.0s)
Example (120 BPM, 1.5s audio):
duration < 2.0s → use 25%
startTime = 1.5 × 0.25 = 0.375s
selectedBeat = floor(0.375 / 0.5) + 1 = 1
Extract segment at beat 1 (adjusted for short audio)
Use cases:
- Quick testing (don't know beat numbers)
- Batch processing (same relative position for all files)
- Safe default (works for most audio)
- When exact position not critical
Limitation:
Not beat-aligned (1.0s may not fall exactly on a beat)
For precise musical alignment, use Specific Beat mode
Parameters & Settings
Core Parameters
| Parameter |
Type |
Default |
Description |
| bpm |
Real |
120 |
Beats per minute (tempo). Range: 40-200 typical. Determines beat duration (secondsPerBeat = 60/bpm). Critical for musical alignment — must match audio tempo accurately. |
| note_value |
Menu |
1/16 |
Rhythmic duration of extracted segment. Options: 1/32, 1/16, 1/8, 1/4, 1/2, triplets (1/16t, 1/8t, 1/4t), dotted (d1/16, d1/8, d1/4, d1/2). Controls segment length and stutter speed. |
| beat_selection_mode |
Menu |
Specific beat |
How to choose segment position. Options: (1) Specific beat number, (2) Random beat, (3) Beat range, (4) Auto (1 second in). See Modes section for details. |
| specific_beat |
Integer |
4 |
Beat number to extract (mode 1 only). Range: 1 to totalBeats. 1-indexed (beat 1 = start of audio). Clamped to valid range if out of bounds. |
| beat_range_start |
Integer |
2 |
First beat of range (mode 3 only). Range: 1 to totalBeats. Must be ≤ beat_range_end (auto-swapped if reversed). Defines start of replacement section. |
| beat_range_end |
Integer |
4 |
Last beat of range (mode 3 only). Range: 1 to totalBeats. Must be ≥ beat_range_start. Defines end of replacement section (inclusive). |
| num_repeats |
Integer |
4 |
Number of times to repeat the segment. Range: 1-50 typical. Higher values = longer stutter section, more decay needed. Total added duration = (num_repeats - 1) × noteDuration. |
| amplitude_decay |
Real |
0.9 |
Decay factor per repeat (exponential). Range: 0.0-1.0. Each repeat amplitude = previous × decay. 0.9 = 10% reduction per repeat. 1.0 = no decay (all repeats equal volume). <0.8 = aggressive decay. |
| fade_repeats |
Boolean |
0 (false) |
Apply fade in/out to segment before repeating. 0 = hard edges (glitchy), 1 = smooth edges (less clicky). Recommended for tonal material. Not needed for percussive material. |
| fade_duration |
Real |
0.01 |
Duration of fade in/out (if fade_repeats enabled). Range: 0.001-0.05s typical. 0.01s = 10ms (smooth but not audibly softened). Must be < noteDuration/2. |
Note Value Reference
| Note Value |
Duration @ 120 BPM |
Duration @ 140 BPM |
Character |
| 1/32 |
62.5 ms |
53.6 ms |
Very fast stutter, granular texture |
| 1/16 |
125 ms |
107 ms |
Classic glitch stutter, fast rhythmic |
| 1/8 |
250 ms |
214 ms |
Medium stutter, clear rhythmic pulse |
| 1/4 |
500 ms |
429 ms |
Slow stutter, obvious repetition |
| 1/2 |
1000 ms |
857 ms |
Very slow, loop-like repetition |
| 1/16 triplet |
83 ms |
71 ms |
Fast triplet feel, shuffle character |
| 1/8 triplet |
167 ms |
143 ms |
Triplet swing, jazzy stutter |
| 1/4 triplet |
333 ms |
286 ms |
Slow triplet, polyrhythmic feel |
| Dotted 1/16 |
188 ms |
161 ms |
Between 1/16 and 1/8, syncopated |
| Dotted 1/8 |
375 ms |
321 ms |
Between 1/8 and 1/4, lilting rhythm |
| Dotted 1/4 |
750 ms |
643 ms |
Long syncopated repeat |
| Dotted 1/2 |
1500 ms |
1286 ms |
Very long, almost loop-like |
Parameter Interaction Guide
Classic Glitch Effect:
- note_value = 1/16 or 1/8
- num_repeats = 4-8
- amplitude_decay = 0.85-0.95
- fade_repeats = 0 (hard edges for glitchy character)
- beat_selection_mode = Random or Specific beat
Smooth Fill Effect:
- note_value = 1/8 triplet or Dotted 1/8
- num_repeats = 3-5
- amplitude_decay = 0.9-0.95 (gentle decay)
- fade_repeats = 1 (smooth edges)
- fade_duration = 0.01-0.02s
Dramatic Breakdown:
- note_value = 1/4 or 1/2
- num_repeats = 3-4
- amplitude_decay = 0.7-0.8 (aggressive decay)
- beat_selection_mode = Beat range (beats 13-16 for bar 4 in 4/4)
Granular Texture:
- note_value = 1/32
- num_repeats = 16-32
- amplitude_decay = 0.92-0.97 (gradual decay over many repeats)
- fade_repeats = 1 (prevent clicks)
Troubleshooting Parameter Issues
Problem: Output too quiet or silent
Cause: Selected segment is silent (RMS < 0.0001) or too many repeats with aggressive decay
Solution: Check Info window for segment RMS warning. Try different beat_selection_mode (Random to explore). Increase amplitude_decay (0.95+). Reduce num_repeats.
Problem: Repeats not aligned to beat grid
Cause: Incorrect BPM, or audio has tempo changes
Solution: Verify BPM with tempo detection tool (aubio, Sonic Visualiser, DAW). If tempo varies, this script unsuitable (requires constant tempo). Use Auto mode to test if BPM roughly correct.
Problem: Clicks/pops in repeated section
Cause: Hard transients at segment edges, no fading
Solution: Enable fade_repeats = 1. Increase fade_duration to 0.015-0.03s. Ensure segment doesn't start exactly on sharp transient (use beat_selection_mode Random to find smoother section).
Problem: Output too loud / clipping
Cause: Many repeats + high decay = cumulative amplitude > 1.0
Solution: Reduce num_repeats. Lower amplitude_decay (0.85 or less). Apply normalization after processing (Scale peak to 0.99 in Praat).
Applications & Use Cases
Electronic Music Production
Glitch/IDM Aesthetics
Settings: 1/16 or 1/32 note, 6-12 repeats, decay 0.88-0.94, no fades
Technique:
- Use Random beat mode to create unpredictable stutter positions
- Process multiple times to generate variation set
- Layer multiple beat repeats at different note values (1/16 + 1/8 triplet)
- Target percussive sections for rhythmic fragmentation
Artists/genres: Aphex Twin, Autechre, Squarepusher (IDM). Glitch hop, experimental electronica. Creates signature "broken beat" aesthetic.
DJ/Dance Music Fills
Settings: 1/8 or 1/16 note, 4-8 repeats, decay 0.9-0.95, optional fades
Technique:
Use Specific Beat mode to target end of phrases (beats 15-16 in 4/4)
Replace last bar before drop/breakdown with beat repeat
Use Beat Range mode (beats 13-16) to create buildup
Combine with filter sweeps in DAW for enhanced effect
Application: Creates tension before drops, fills gaps in arrangements, adds rhythmic interest to transitions. Common in house, techno, dubstep.
Ambient/Textural Processing
Settings: Dotted notes or triplets, 4-6 repeats, decay 0.92-0.97, fades enabled
Technique:
- Target sustained notes or pad sections (not percussive material)
- Use longer note values (dotted 1/4, 1/2) for subtle repetition
- Enable fade_repeats with 0.02-0.03s fade for smooth texture
- Gentle decay (0.95+) creates "echo" rather than "stutter" effect
Result: Adds movement to static textures, creates polyrhythmic layers, generates evolving ambience from simple source. Useful for sound design, film scoring.
Hip-Hop & Beat Production
Beat Juggling Simulation
Settings: 1/4 or 1/8 note, 2-4 repeats, decay 0.95-1.0 (minimal), no fades
Technique:
- Target specific drum hits (kick, snare) using Specific Beat mode
- Use decay=1.0 for equal-volume repeats (simulates DJ doubling beat)
- Combine multiple beat repeats on different elements (kick + snare separately)
- Create "skip" effect by repeating short segments
Application: Mimics turntablist techniques (beat juggling, transforming). Creates stuttered drum patterns. Useful for boom-bap, lo-fi hip-hop, instrumental beats.
Sample Chopping Enhancement
Settings: 1/16 triplet or 1/8 triplet, 3-5 repeats, decay 0.85-0.9
Technique:
- Apply to chopped samples before arranging in DAW
- Use triplet subdivisions for swing/shuffle feel
- Target melodic elements for "stutter melody" effect
- Random mode for variation across multiple sample chops
Result: Adds rhythmic complexity to samples, creates J Dilla-style swing, generates unexpected syncopations. Enhances sample-based production workflows.
Experimental Composition
Generative Variation
Approach:
- Process same source audio 10-20 times with Random beat mode
- Each iteration produces different stutter pattern
- Collect variations, select best 3-5 for composition
- Layer selected variations for dense polyrhythmic texture
Application: Generative music systems, algorithmic composition, exploring parameter space. Creates unified family of variations from single source.
Rhythmic Transformation
Technique:
- Start with non-rhythmic material (drones, field recordings, noise)
- Apply beat repeat with short note values (1/16, 1/32)
- Transforms sustained sounds into rhythmic patterns
- Multiple passes create increasingly fragmented textures
Result: "Rhythmicizes" non-rhythmic material. Creates emergent rhythms from static sources. Useful for experimental electronic, musique concrète, sound art.
Sound Design & Post-Production
Sci-Fi/Futuristic Effects
Material: Whooshes, impacts, mechanical sounds, drones
Settings: 1/16 or 1/32, 8-16 repeats, decay 0.9-0.95
Application: Creates "glitchy" technology sounds, malfunctioning robot effects, data transmission aesthetics, cyberpunk atmospheres. Used in film/game sound design.
Transition Effects
Material: Risers, impacts, cymbal crashes
Settings: 1/8 or dotted 1/8, 4-6 repeats, decay 0.85-0.9
Application: Enhanced transitions for film/video editing. Adds rhythmic intensity to scene changes. Creates "stutter cut" effect without manual editing.
Teaching & Demonstration
Rhythm Visualization
Educational use:
- Demonstrate note value differences (compare 1/8 vs 1/16 vs triplets)
- Teach tempo relationships (process at 60, 120, 180 BPM — hear subdivision changes)
- Illustrate exponential decay (compare decay=0.7 vs 0.9 vs 1.0)
- Show beat grid alignment (use Specific Beat to target exact positions)
Audience: Music theory students, audio engineering courses, electronic music production workshops.
Comparison to DAW Beat Repeat
| Feature |
Ableton Live Beat Repeat |
Praat Beat Repeat Script |
| Real-time |
Yes (live effect, MIDI-triggerable) |
No (offline processing, renders to new file) |
| Tempo sync |
Auto-syncs to project tempo |
Manual BPM input required |
| Note values |
Full range + free division |
12 preset note values (standard + triplets + dotted) |
| Selection |
Random with probability, gate threshold |
4 modes: Specific, Random, Range, Auto |
| Decay |
Exponential + custom curves |
Exponential only (simple power function) |
| Pitch shift |
Yes (optional on repeats) |
No (preserves original pitch) |
| Filter |
Yes (optional filter on repeats) |
No (no built-in filtering) |
| Workflow |
Insert as track effect, process in real-time |
Run script on Sound object, creates new file |
| Advantages |
Real-time, automation, MIDI control, more features |
Offline flexibility, precise control, no DAW required, batch processing potential |
Technical Deep Dive
Algorithm Implementation
Main Processing Flow
Step-by-step algorithm:
INPUT: Sound object, BPM, note_value, beat_selection parameters, repeat parameters
STEP 1: Calculate tempo-based timing
secondsPerBeat = 60 / bpm
totalBeats = floor(duration / secondsPerBeat)
noteDuration = calculateNoteDuration(note_value, secondsPerBeat)
STEP 2: Determine segment start time
switch (beat_selection_mode):
case Specific beat:
startTime = (specific_beat - 1) × secondsPerBeat
case Random beat:
selectedBeat = randomInteger(2, totalBeats - 1)
startTime = (selectedBeat - 1) × secondsPerBeat
case Beat range:
startTime = (beat_range_start - 1) × secondsPerBeat
rangeLength = (beat_range_end - beat_range_start + 1) × secondsPerBeat
case Auto:
startTime = 1.0 (or duration × 0.25 if duration < 2.0)
STEP 3: Boundary checking
if startTime + noteDuration > duration:
startTime = duration - noteDuration
if startTime < 0:
startTime = 0
noteDuration = duration
STEP 4: Extract segment
segment = Extract part: startTime, startTime + noteDuration
STEP 5: Optional fade
if fade_repeats:
Fade in: 0, 0, fade_duration
Fade out: 0, 0, fade_duration
STEP 6: Create repeats with decay
repeated = Copy segment (repeat 1, no decay)
for i from 2 to num_repeats:
this_repeat = Copy segment
decayFactor = amplitude_decay^(i-1)
Formula: "self * decayFactor"
repeated = Concatenate(repeated, this_repeat)
STEP 7: Extract before/after sections
if startTime > 0:
before = Extract part: 0, startTime
afterStart = startTime + noteDuration (or startTime + rangeLength for Beat range mode)
if afterStart < duration:
after = Extract part: afterStart, duration
STEP 8: Final assembly
result = Concatenate(before, repeated, after)
Rename: originalName + "_beat_repeat"
STEP 9: Diagnostic output
Print segment RMS, total beats, note duration, final RMS to Info window
Warn if segment or output too quiet
OUTPUT: New Sound object with beat repeat effect applied
Note Duration Calculation Details
Complete Note Value Mapping
All 12 note value calculations:
Given: secondsPerBeat (from BPM)
note_value = 1: 1/32 note
noteDuration = secondsPerBeat / 8
Rationale: 32nd note is 1/8 of a quarter note
note_value = 2: 1/16 note
noteDuration = secondsPerBeat / 4
Rationale: 16th note is 1/4 of a quarter note
note_value = 3: 1/8 note
noteDuration = secondsPerBeat / 2
Rationale: 8th note is 1/2 of a quarter note
note_value = 4: 1/4 note
noteDuration = secondsPerBeat
Rationale: Quarter note = one beat in 4/4 time
note_value = 5: 1/2 note
noteDuration = secondsPerBeat × 2
Rationale: Half note = two beats in 4/4 time
note_value = 6: 1/16 triplet
noteDuration = (secondsPerBeat / 4) × (2/3)
Rationale: Triplet = 2/3 of standard note duration
note_value = 7: 1/8 triplet
noteDuration = (secondsPerBeat / 2) × (2/3)
note_value = 8: 1/4 triplet
noteDuration = secondsPerBeat × (2/3)
note_value = 9: Dotted 1/16
noteDuration = (secondsPerBeat / 4) × 1.5
Rationale: Dotted note = 1.5× standard duration
note_value = 10: Dotted 1/8
noteDuration = (secondsPerBeat / 2) × 1.5
note_value = 11: Dotted 1/4
noteDuration = secondsPerBeat × 1.5
note_value = 12: Dotted 1/2
noteDuration = (secondsPerBeat × 2) × 1.5
All durations in seconds
Boundary and Edge Cases
Handling Audio Duration Constraints
Script robustness measures:
CASE 1: Segment extends past end of audio
if startTime + noteDuration > duration:
Adjustment: startTime = duration - noteDuration
Effect: Shift segment left to fit within audio bounds
if startTime < 0 (noteDuration > duration):
Adjustment: startTime = 0, noteDuration = duration
Effect: Use entire audio as segment
CASE 2: Beat number out of range (Specific beat mode)
if specific_beat < 1:
Adjustment: specific_beat = 1
if specific_beat > totalBeats:
Adjustment: specific_beat = totalBeats
Effect: Clamp to valid beat range
CASE 3: Beat range reversed or invalid (Beat range mode)
if beat_range_start > beat_range_end:
Adjustment: Swap(beat_range_start, beat_range_end)
if beat_range_start < 1:
Adjustment: beat_range_start = 1
if beat_range_end > totalBeats:
Adjustment: beat_range_end = totalBeats
CASE 4: Very short audio (Auto mode)
if duration < 2.0:
Adjustment: startTime = duration × 0.25 (instead of 1.0s)
Effect: Proportional positioning for short audio
CASE 5: Too few beats for Random mode
if totalBeats ≤ 2:
Adjustment: selectedBeat = 1
else:
selectedBeat = randomInteger(2, totalBeats - 1)
Effect: Avoid random selection on very short audio
CASE 6: Silent segment detected
if segment_rms < 0.0001:
Action: Print warning to Info window
Suggestion: "Consider selecting a different beat"
Effect: User alerted but processing continues
CASE 7: Output too quiet
if final_rms < 0.0001:
Action: Print warning to Info window
Suggestion: "Try a different beat or increase amplitude_decay"
All adjustments ensure script never crashes, always produces output
Concatenation Logic
Three-Part Assembly
Handling all combinations of before/after presence:
Define:
hasBefore = (startTime > 0)
hasAfter = (afterStart < duration)
CASE 1: Both before and after exist
if hasBefore = 1 AND hasAfter = 1:
result = Concatenate(before, repeated, after)
Cleanup: Remove before, after
CASE 2: Only before exists (segment at end)
if hasBefore = 1 AND hasAfter = 0:
result = Concatenate(before, repeated)
Cleanup: Remove before
CASE 3: Only after exists (segment at start)
if hasBefore = 0 AND hasAfter = 1:
result = Concatenate(repeated, after)
Cleanup: Remove after
CASE 4: Neither exists (entire audio is segment)
if hasBefore = 0 AND hasAfter = 0:
result = Copy(repeated)
No cleanup needed
Final result always named: originalName + "_beat_repeat"
Segment and repeated objects always removed (cleanup)
Output duration calculation:
if beat_selection_mode ≠ Beat range:
output_duration = duration + (num_repeats - 1) × noteDuration
if beat_selection_mode = Beat range:
removed_duration = rangeLength
added_duration = num_repeats × noteDuration
output_duration = duration - removed_duration + added_duration