drumbox - Simple drum machine that sequences its input samples.
Inputs:
bpm [FLOAT] [REQUIRED]: tempo in beats per minute.
divs [FLOAT] [OPTIONAL]: number of subdivision per beat, def 4.
sample0 [BUFFER] [REQUIRED]: sample #0.
sample1 [BUFFER] [OPTIONAL]: sample #1.
sample2 [BUFFER] [OPTIONAL]: sample #2.
sample3 [BUFFER] [OPTIONAL]: sample #3.
sample4 [BUFFER] [OPTIONAL]: sample #4.
sample5 [BUFFER] [OPTIONAL]: sample #5.
sample6 [BUFFER] [OPTIONAL]: sample #6.
seq0 [STRING] [REQUIRED]: sequence #0, an ’x’ triggers sample0, a ’-’ indicates a silent beat, all other characters are ignored.
seq1 [STRING] [OPTIONAL]: sequence #1.
seq2 [STRING] [OPTIONAL]: sequence #2.
seq3 [STRING] [OPTIONAL]: sequence #3.
seq4 [STRING] [OPTIONAL]: sequence #4.
seq5 [STRING] [OPTIONAL]: sequence #5.
seq6 [STRING] [OPTIONAL]: sequence #6.
Outputs:
out [BUFFER]: output full sequence.
Each sample has an associated sequence seq<N> of the same number. A sequence is a string containing ’x’, ’-’ and white spaces, that describes the rhythmic sequence of the corresponding sample. Each ’x’ and ’-’ corresponds to a subdivision of a beat, if ’x’ then the sample is triggered, ’-’ is a silent tick. The number of subdivisions per beat is set with divs, and the tempo in beat per minute (BPM) with bpm.
The output buffer contains the whole rhythmic pattern. It has the sampling rate of input0. Note that all samples must have the same sampling rate and all sequences must have the same length (in effect, the same number of ’x’ and ’-’ as other characters are simply ignored).
rhythm: drumbox
{
bpm: 120;
divs: 4;
/* k, n and h
hypothetical nodes declared above */
sample0: k.out;
sample1: s.out;
sample2: h.out;
seq0:
"x--- x--- x--- x--- x--- x--- x--- x-x- x--- x--- x---
x--- x--- x--- x--- x-x-";
seq1: "--x- --x- --x- --xx --x- --x- --x- --xx --x-
--x- --x- --xx --x- --x- --x- --xx";
seq2: "---- x--- ---x -x-- ---- x--- ---x -x-- ----
x--- ---x -x-- ---- x--- ---x -x--";
}