Forums > MaxMSP

Fade out audio after crossing video motion threshold

February 10, 2013 | 4:01 am

I’m having trouble googling this because I don’t know what to call it.

Basically, I’m using a webcam to control the volume of sound in a room. If nobody is in the room, the sound shouldn’t play. However, this needs to have a reasonably long time-out value so that it doesn’t accidentally stop playing while there are people in the room.

So I’ve got a jit.qt.grab, going to a jit.change with a reasonably high threshold value. My playback is controlled by 4 play~ objects through a 4-channel live.gain~ object.

How do I extract the motion data from jit.change and give it to live.gain with a timeout so as to accomplish my purposes?

Thanks in advance


February 10, 2013 | 11:17 am

I’d suggest you using cv.jit externals to perform a more precise tracking. http://jmpelletier.com/cvjit/
In this example, I’m using [cv.jit.label] and [cv.jit.blobs.centroids] to track the presence of people in the room.
Then, the output of the [cv.jit.blobs.centroids] triggers a [line~] object connected to a [*~] generating a volume ramp.

– Pasted Max Patch, click to expand. –

hope it helps.


February 10, 2013 | 11:52 am

The qmetro can do all this voodoo by itself ? :))


February 10, 2013 | 5:10 pm

Yes, qmetro is a very powerful object, if you connect it to something else :)

Sorry for messing with copy & paste….
Here should be the right patch

– Pasted Max Patch, click to expand. –

February 11, 2013 | 12:03 am

LSka, I’m not sure what your example is–the posted code is just a qmetro.

I have a metro connected to the qt.grab, which outputs fps (i guess?) Not sure how it does that. However, I’m having a hard time getting reasonable results with the actual fps numbers. It doesn’t just nicely decrease to zero, so I can’t just pick an fps threshold (I think)

I’m currently looking into cv.jit; I’ll see how that goes.

edit: sorry, I just saw your updated post.


February 11, 2013 | 1:29 am

edit: i’m dumb, thank you so much!

Thanks


June 30, 2013 | 11:14 am

Thank you for this patch LSKA !


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