Help With Code

For general discussion related FlowStone
Post Reply
Audiocave
Posts: 1
Joined: Tue Apr 15, 2014 9:26 pm

Help With Code

Post by Audiocave »

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..

    - 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
end


Here's my main module code...

Any help would be appreciated. Thanks.
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Help With Code

Post by nix »

DS_RC2015.fsm
(371.93 KiB) Downloaded 883 times


Here is a sequencer I wrote, it doesn't use much cpu, but it uses a little too much RAM.
The timer itself doesn't though.

I can't see why the code snippet is too heavy, it goes slowly

If you up the schematic, maybe I or someone is keen to have a look mate
Post Reply