Page 1 of 1

How to realize the counter algorithm for DSP module?

PostPosted: Sat May 26, 2018 7:26 pm
by keyjslider1
Dear colleagues, I would need to count incoming events/triggers (MIDI notes) within the DSP prim. At that what is the right code to increment the counter only when the desired event comes into input, and not when idle?? Please, do not suggest the Ruby prim, I need this to be realized only within DSP pane. Thank you in advance.

Re: How to realize the counter algorithm for DSP module?

PostPosted: Mon May 28, 2018 1:31 am
by martinvicanek
Like so?

Re: How to realize the counter algorithm for DSP module?

PostPosted: Tue May 29, 2018 1:01 am
by keyjslider1
martinvicanek wrote:Like so?

Thank you Martin. Probably a little in a different way. But thanks, cause I am new to DSP coding, there are things to for me learn from your module.
Actually, I need not to simply count notes, but count MIDI events coming out of MIDI Split prim as 5-params' set in order to derive unique MIDI-event index to write into array within DSP pane with the further goal to record and manupulate these MIDI-events...At that the MIDI to Poly conversion is not the way for me to go.
I made the module attached, one could even find it useful for some purposes... If you substitute code string "c1=c1+((P*res)>0)&P" for "c1=c1+((P*res)>0)&1", the code will count the amount of how many times the MIDI events, being aligned to the same time signature, come up during playback. Thus it will count chords - if only notes are on input...

Re: How to realize the counter algorithm for DSP module?

PostPosted: Wed May 30, 2018 8:34 am
by martinvicanek
Imho what you are after would be more appropriate for Ruby. DSP code is for high prrformance, low latency, and no jitter. Ruby is much moreversatile for complex stuff.

Re: How to realize the counter algorithm for DSP module?

PostPosted: Wed May 30, 2018 9:24 am
by keyjslider1
martinvicanek wrote:Imho what you are after would be more appropriate for Ruby. DSP code is for high prrformance, low latency, and no jitter. Ruby is much moreversatile for complex stuff.


Agree. Unfortunately, some Ruby live MIDI processing implementations deliver often unexpected CPU load peaks up to 20-35% on my machine - and this all without synths and effects, whereas DSP implementation constantly loads CPU less then 3-5%... I would never mess around DSP which is rather tricky to program...

Re: How to realize the counter algorithm for DSP module?

PostPosted: Thu May 31, 2018 12:52 am
by tulamide
keyjslider1 wrote:
martinvicanek wrote:Imho what you are after would be more appropriate for Ruby. DSP code is for high prrformance, low latency, and no jitter. Ruby is much moreversatile for complex stuff.


Agree. Unfortunately, some Ruby live MIDI processing implementations deliver often unexpected CPU load peaks up to 20-35% on my machine - and this all without synths and effects, whereas DSP implementation constantly loads CPU less then 3-5%... I would never mess around DSP which is rather tricky to program...

That's probably more of a mistake or something else on your side. Look at Viper by Adam, pretty much everything GUI and MIDI is Ruby. Without issues.

You should notice however, that Flowstone draws if needed, not constantly. It will always prefer audio, but the rest of the cpu load is used to its fullest to draw as quickly as possible. Such spikes are normal and have nothing to do with Ruby. Maybe that's what you see?