Expand description
Rhythm arithmetic: Euclidean patterns, swing and ticks.
A bar has 16 sixteenth slots, numbered 0 to 15. Ticks count 480 per quarter note, as in the MIDI files the tool writes.
use sound_to_patch::music::rhythm::{euclid, onsets, ticks_for_ms};
assert_eq!(onsets(&euclid(3, 8)), [0, 3, 6]);
assert_eq!(ticks_for_ms(5.0, 120.0), Some(5));Enums§
Functions§
- euclid
- The Euclidean pattern of
konsets overnsteps. - onsets
- The steps that hold an onset.
- rotate
- The pattern with every onset moved
rotationsteps later, wrapping around. - sixteenth_
ms - The length of a sixteenth in ms: a quarter of the beat period of the stem’s beat grid.
- slot_
ticks - The ticks of one slot of a bar of
gridslots: 12, 16 or 24 slots give 160, 120 or 80 ticks. - swing_
delay - The delay of the second note of a swung pair, in sixteenths, for a pair
percent
pct(50 is straight) and a pair of sixteenths. - swing_
pct - The pair percent of a long-to-short ratio.
- swing_
ratio - The long-to-short ratio of a pair percent.
- swing_
ticks - The delay of the second note of a swung pair in ticks.
- tick_ms
- The length of one tick in ms,
1000 / ticks per second, the tick the MIDI writer uses. - ticks_
for_ ms - The whole ticks that cover
msat a tempo, rounded up, so an overlap is never shorter than asked.