Send a quarter-note's worth of MIDI clock ticks

midi_clock_beat  duration (beats)

Sends enough MIDI clock ticks for one beat to all connected MIDI devices. Use the port: opt to restrict which MIDI ports are used.

The MIDI specification requires 24 clock tick events to be sent per beat. These can either be sent manually using midi_clock_tick or all 24 can be scheduled in one go using this fn. midi_clock_beat will therefore schedule for 24 clock ticks to be sent linearly spread over duration beats. This fn will automatically take into account the current BPM and any time_warps.

Introduced in v3.0

Examples

# Example 1

midi_clock_beat



#=> Send 24 clock ticks over a period of 1 beat



# Example 2

midi_clock_beat 0.5



#=> Send 24 clock ticks over a period of 0.5 beats



# Example 3

live_loop :clock do 
  midi_clock_beat   
  sleep 1
end



# Create a live loop which continually sends out MIDI clock
# events at the current BPM
 
 



# Example 4


live_loop :clock do
  midi_start if tick == 0
  midi_clock_beat        
  sleep 1                
end



# Ensuring Clock Phase is Correct
 
# Send a midi_start event the first time round the live loop only
# this will not just send a steady clock beat, but also ensure
# the clock phase of the MIDI device matches Sonic Pi.