Video blobs trigger midi notes

Sachone's icon

Hey there,

I know it's a long discussed subject in these forum pages but being novice on max and following step by step tuts and advices to build my patch, I'm stuck for a while trying to solve something that seems simple but just drive me crazy.
Here is the thing: I'm performing a blob detection on a video and extract blobs infos (via cv.jit.blobs.centroids) to trigger midi notes. What I would like to do is trigerring a midi note "on" message whenever a new blob's detected and triggering a midi note "off" message whenever it disappears. The problem is that my blob continuously output bangs which continuously reset the midi sound produced.
I tried to filter these extra and useless bangs out with several objects (onebang, change, zl change) but can't get it to work.
Any suggestion will be greatly appreciate !

Sachone's icon

Well, no answer yet, maybe my question's a little abstract, here is my patch, guess it could help to visualize the thing (you'll need cv.jit abstraction to play it).
When you load a video (Read) and the blobs detection's performed, it triggers continuously bangs on "noteout", but I would just need the first one (basically to trigger a note) and a release message when the blob disappears.

5439.VideoAnalysis.maxpat
Max Patch
yaniki's icon

I deleted jit.cv from my computer, so I can't check it now, but this should be something like in modified patch (attached one).

5444.5439.VideoAnalysis.maxpat
Max Patch
Oli Mason's icon

Cant check you patch at the moment but....

what might be worth checking out is cv.jit.touches as it sends out a 'mouse down' and 'mouse up' message when it detects a blob, which you could convert the note on and off?

Not sure if the blob tracking would be as precise as what you need tho.

Just a thought,

Regards,

Oli

Sachone's icon

Thanks for your answers, gonna try this out this week end !