counter

Create MIDI File

This is an example that generates a sixteenth-note rhythm, formats the information as MIDI note messages with midiformat, and stores them in a seq object, which can be saved as a MIDI file with the write message. 

Algorithmic counting

This patch demonstrates an application of modular arithmetic to wrap a series of numbers around within a defined range. The algorithm produces a series of expanding steps: 0, 1, 3, 6, 10, 15, 21, etc. The difference between each number and its predecessor in the series increases with each step—1-0=1, then 3-1=2, 6-3=3, 10-6=4, and so on. We do this by incrementing a counter and adding its output to the previous output of the + object.

Poly-rhythm generator

To create a poly-rhythm generator, this example chooses a division and articulates every attack point of that division. Use a metro synched to the transport to specify the divisions (or the tempo object, if preferred), and then use a counter (or a % object with the output of tempo) to specify the articulation points.