How can i send MIDI messages at a certain point in the song?

Hi guys, i want to send MIDI messages at a certain point in my song by using "tick ", like that:

live_loop :midi_drum_send, sync: "/live_loop/drums" do
  midi_note_on [10, 20 ,30].choose if tick >= 90
  sleep 0.125
end

but it doesn’t work. The program sends MIDI notes from the beginning of the song, i want to send notes when the program hits 90 ticks.

Hmm It worked for me. Of yourse you need to have a l
live_loop :drums do
#content
end
as well for it to sync to.
I tested it with this (I changed the midi notes a bit so I could here them and also reduced the number of ticks to wait.

live_loop :drums do # second loop will sync to this one.
  sample :drum_cymbal_hard
  sleep 1
end


live_loop :midi_drum_send, sync: "/live_loop/drums" do
  midi_note_on [72, 77 ,84 ].choose if tick >= 24
  sleep 0.125
end
1 Like

I understood the problem:

the problem was that the “live_loop :drums” has a different sleep time respect to “live_loop :midi_drum_send” :

sample :loop_amen_full, hpf: 75 ,beat_stretch: 8, start: s, finish: f, amp: drum_v #if tick >= 90
            sleep sample_duration :loop_amen_full, beat_stretch: 8, start: s, finish: f
live_loop :midi_drum_send, sync: "/live_loop/drums" do
  midi_note_on [10, 20 ,30].choose if tick >= 90
  sleep 0.125
end

The result in this case is that “live loop:midi drum send” hits 90 ticks faster than “live_loop:drums” than I wanted;

so, i decided to increase the threshold of the tick in the “live loop:midi drum send”, like that:

live_loop :midi_drum_send, sync: "/live_loop/drums" do
  midi_note_off [40, 50 ,60].choose if tick >= 355
  sleep 0.25
end

@robin.newman Thanks for the reply!