Hi,
a question: Has anyone thought about or even a sketch/solution of how to quantise midi input in Sonic Pi?
(Is this feasible at all?)
Hi,
a question: Has anyone thought about or even a sketch/solution of how to quantise midi input in Sonic Pi?
(Is this feasible at all?)
Perhaps all MIDI events could be added to a buffer and then have live_loop
that pulls events from the buffer and schedules them at regular intervals?
Hi @nabisco,
yes, that is what I somehow thought about. Maybe this is a candidate for the time_warp
function.
The broader context is that I thought about providing some midi input and record it (quantised) and play it back (such as 8 beats later). Maybe I am on the wrong path with my idea, that’s why I bringing it up for discussion.
I played around with recording midi events for a drum machine.
I saved the key and time and used the quantise function.
It didn’t work well and I scrapped it, I’ll see if I still have the code.
Oh, I completely forgot! There is already a quantise
function. Thanks for the reminder.
And yes, I would be interested in your code to maybe get me started!
Didn’t find the original code, here is something more recent (still not working though ):
#Recording MIDI events
#####Working:
live_loop :scan do
key,vel = sync "/midi/*/*/1/note_on"
t = get 'time'
cue 'event', key,t[0] #Sends a message with key and time
end
live_loop :timer do
4.times do #Equals 4/4
4.times do #Equals 1/4
cue 'time', tick / 4.0
sleep 0.25 #Equals 1/16
end
end
clear
end
#####Not Working/Unfinished:
keys = []
times = []
live_loop :recorder do
key,t = sync 'event'
keys = keys + key
times = times + k
#Needs something to stop recording after 4bars, 8bars?
end
#Run through the lists with at?