Forums > Dev


May 03 2016 | 7:16 pm

This is some code for finding the centroid of a transient. A click in the right inlet will trigger the analysis. Playing around with it has convinced me it’s super useful however I’m not super confident in my C coding so I won’t be publishing this as part of any packages. I’m really nervous about memory leaks etc. If someone wants to look it over and possibly alter it, go for it.

It computes an FFT, finds a bark(ish) scale and then gives the centroid of that scale. It’s probably great at analyzing table drumming.

May 04 2016 | 4:14 am

Hi Matt,

I gave a quick glance at your code and it has has some issues.
It is not a good idea to make outlet calls from the perform routine.
Read the chapter "Anatomy of a MSP Object" from the Max/MSP SDK.
You want to create and use a clock to schedule outlet calls from the high priority thread.
Since a clock_delay() function will be called from the perform routine, you also need to pay attention not to clog the scheduler by calling the function too often, especially at small vector sizes.
Going from the audio thread to the scheduler thread is not trivial in complex scenarios.
Your scenario is not very complex but you need to take care of a few important things.
I am sorry for being so general, but I don’t have time to go into specifics right now…
Maybe someone else may be able to go more in depth…

Hope this helps somehow.
Take care

– Luigi

May 04 2016 | 5:41 am

Don’t be sorry. This is why I didn’t distribute it as opposed to just posting the code.
It’s good to know this stuff. Guess I have more to learn. Hope I can figure it all out!

It also sounds like it may be smarter to send a click out with my centroid value.


May 04 2016 | 5:57 am

Also if anyone has any further advice here, I’m sort of lost as to what to read. Anatomy of an MSP object is actually *more* general than Luigi.

Viewing 4 posts - 1 through 4 (of 4 total)

Forums > Dev