Yes, the midi spec requires it but Sonic Pi’s midi_clock_beat is particular to SPi.
If you look at SPi lang, you can see the inclusion of the relevant Midi Spec version in yellow i.e.
So ’ MIDI 1.0 Specification - System Real-Time Messages - Timing Clock’
But midi_clock_beat does not refer and link back tot he Midi Spec, irrespective of version.
Arpeggiators only require a pulse (tick), gate, so are more straightforward.
Which synth’s onboard seq are you using?
I think of the tick/beat distinction as follows, in respect of making a difference:
- A tick is a single entity - so to achieve 24 ticks, the code needs to be called 24 times
- The beat sends out 24 ticks for the duration of one beat, so only needs to be called once every beat and SPi sends out the 24 ticks
In terms of sequencer behaviour, it varies depending upon how they’ve been implemented. Some sequencers in modular use the rising edge of the pulse and others the falling edge. When they receive the reset pulse this behaviour can also vary. As most soft synths and hardware ‘tend’ to model the capabilities of older sequencer hardware, then this means there will be variability dependant upon which hardware sequencer was modelled.
One of my Eurorack sequencers is the Westlicht Perf|former. This is from their manual regarding midi clocks:
“Note: To set up a 24 PPQN input or output clock resolution, the divisor needs to be set to 2. This is because the divisor is applied to a 48 PPQN resolution instead of the internal 192 PPQN resolution.”
So PPQN is the equivalent of SPi’s tick.
In respect of master clocks, similar to what you’re doing:
" In Restart mode, the master clock is restarted. In Pause mode, the master clock is stopped/resumed."
And the info for these different modes:
" Mode in which to handle the incoming clock control signal. In Reset mode, the clock is kept in reset state while a high signal is read. In Run mode, the clock is only run when the signal is high. In Start/Stop mode, the clock is started when a high signal is read and stopped/paused when a low signal is read."
The reference to high/low signal refer to the state of a clock pulse where the states, assuming 50/50 low/high, sends out either 5 Volts (high) 0 Volts (low).
Of course, any one of my other hardware sequencers will behave differently, which means there isn’t a set and forget approach but instead one that needs to take into account local differences. Therefore
ticks can be thought of similarly. When you send a
tick it is the equivalent of the pulse sending out a high state. This means the control of these ticks can be in singles, regular, odd, or rapid bursts, dictated to by the
sleep value. So a ring of sleep values can be used in this manner:
live_loop :myloop do
midi_clock_tick port: mySynth
sleep (ring 0.5, 0.25, 0.125, 0.0625, 0.0625).tick
And if you want more variability then you can use
pick or use the
ring chain commands to create variations.