SPB Git

Repository Public

glitch-fills.md 2.8 KB 65 lines markdown

1# Glitch Fills23For sixteen bars, the last bar of every four-bar phrase gets four short beat-repeat fills, each with a slice length picked from a list. The picks come from `random()`, which gives the same sequence on every run: the fills sound varied, and the routine is identical each time you play it. It shows `random`, `len`, array indexing with a computed index, and nested `repeat`.45## The script67```orixdj8automation "Glitch Fills" quantize bar {9    let slices = [1/2beat, 1/4beat, 1/4beat, 1/8beat, 1/16beat]10    let phrases = 4           // number of four-bar phrases1112    repeat phrases {13        wait 3 bars14        // Fourth bar of the phrase: four one-beat fills with slices picked from the list.15        repeat 4 {16            let pick = floor(random() * len(slices))17            fx.beatrepeat.length = slices[pick]18            fx.beatrepeat.enable()19            wait 3/4beat20            fx.beatrepeat.disable()21            wait 1/4beat22        }23    }24}25```2627## What happens, bar by bar2829| Position | What happens |30| --- | --- |31| Before bar 1 | The automation waits for the next bar line. |32| Bars 1 to 3 | Nothing: the track plays. |33| Bar 4 | On each beat: a slice length is picked, the master beat repeat is switched on for three quarters of a beat, then off for the last quarter. |34| Bars 5 to 16 | The same phrase three more times: three bars of music, one bar of fills (bars 8, 12 and 16). |35| Bar 17, beat 1 | The automation finishes with the beat repeat switched off. |3637## When to use it3839To add variation to a long, repetitive section without touching anything by hand. Start it on the first bar of a phrase so that the fills land on bars 4, 8, 12 and 16.4041## Check before running it live4243- Something is playing through the master.44- The master beat repeat is free to be reconfigured.45- The automation starts on a phrase boundary: `quantize bar` gives a bar line, the choice of the bar is yours.46- You have listened to the sequence once: it is always the same, so if one fill is unpleasant you can change the list.4748## Notes and variations4950`random()` returns a number from 0 up to 1. Multiplying by `len(slices)` and rounding down with `floor` gives a whole number from 0 to 4, a valid index into the five-element list. In the simulator the first bar of fills uses slices of 1/4, 1/16, 1/4 and 1/4 beat.5152The sequence restarts each time the automation is started. Two runs give the same fills; a longer run continues the sequence.5354`let pick` is declared inside the inner loop. It is a new value on every turn and exists only within that block.5556If the script failed in the middle of a fill, the runtime would switch the effect off again.5758## Related5960- [Types](../types.md)61- [Loops](../loops.md)62- [Effects Commands](../effects-api.md)63- [Presets](../presets.md)64- [Examples](README.md)65
Files main
Menu

Theme