Help With Code
Posted: Mon Nov 14, 2016 2:02 pm
Hi guys.
I have a schematic for a drum sequencer which will play midi notes from a plugin out to my daw. It's all fine except for when I send midi notes the CPU use goes through the roof, spikes really badly. I've done a few things to try to reduce the load like..
But still, it's unworkable as it is sending a midi note even one midi note while running. Assume below that the ticker is sending 0-64 for 8 bars of 8th notes and this code below triggering a single note spikes my CPU, let alone trying to fill out the grid later with multiple drum notes.
Here's my main module code...
Any help would be appreciated. Thanks.
I have a schematic for a drum sequencer which will play midi notes from a plugin out to my daw. It's all fine except for when I send midi notes the CPU use goes through the roof, spikes really badly. I've done a few things to try to reduce the load like..
- - Move some of the graphics drawing for the progress update to global variables so that instead of it creating a new pen, new color, etc, etc, on every 8-16th note trigger those things are already set. That helped a tiny bit.
- Rewrote the project to put most of my Ruby code into the main module. That helped a tiny bit.
- Put the midi trigger code into it's own module so only the ticker triggers would be hitting that event block.
But still, it's unworkable as it is sending a midi note even one midi note while running. Assume below that the ticker is sending 0-64 for 8 bars of 8th notes and this code below triggering a single note spikes my CPU, let alone trying to fill out the grid later with multiple drum notes.
Code: Select all
def event i,v
if @ins[0] == 8 then
on = Midi.new 144,1,36, $triggers[@pos]
off = Midi.new 128,1,36,100
output 0, on
output 0, off, t+0.25
end
endHere's my main module code...
Any help would be appreciated. Thanks.