How to realize the counter algorithm for DSP module?

DSP related issues, mathematics, processing and techniques
Post Reply
keyjslider1
Posts: 20
Joined: Tue Mar 13, 2018 2:19 pm

How to realize the counter algorithm for DSP module?

Post 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.
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

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

Post by martinvicanek »

Like so?
Attachments
NoteCounter.fsm
(5.4 KiB) Downloaded 1450 times
keyjslider1
Posts: 20
Joined: Tue Mar 13, 2018 2:19 pm

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

Post 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...
Attachments
DSP Recorder4.fsm
Sorry for some junk modules there - needs a little clean-up))
(140.31 KiB) Downloaded 1452 times
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

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

Post 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.
keyjslider1
Posts: 20
Joined: Tue Mar 13, 2018 2:19 pm

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

Post 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...
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

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

Post 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?
"There lies the dog buried" (German saying translated literally)
Post Reply