Perform action when sound comes above threshold?
I bought an external sound card, and what I want to do is listen to 5 microphones simultaneously, and only start recording sound once the microphones' sound level comes above a certain threshold. (let's say when I clap my hands, or somebody walks by)
I assume that when using the analog to digital converter, the software picks up a sound level from 0 to 1023, and that I just could simply say (in abstract language) "if soundlevel > 300, then... etc." but I'm reading forum posts and doing tutorials for the last 7 hours now and I can't get it to work.
So I just want to define a soundvolume threshold, that when being reached triggers an action. Can somebody here maybe guide me in the right direction, or tell me specifically which websites or tutorials to take a look at?
quick and dirty solution:
wow, that's even better than a website link or tutorial... many thanks! =) just a small question though to understanding the structure behind it.
I guess the [0.3 value * float] sets the threshold for the soundvolume, but from what range does this go? Since I read that maxmsp's coding can be compared to C, I assumed this would be 0 to 1023, but since your numbers are so small I think I'm wrong.
Last thing: I'm experimenting with three different soundvolume ranges now (to let the software do something different when the soundvolume is in quiet range 1, compared to when the volume is in louder ranges 2 or 3). Can I simply say ">0.3 &&
the output range of the meter~ object is range is 0...1 from an input which is not amplified (though you could amplify it more in max)
the sound data itself (msp signal) normally ranges from -1. to 1., this is what the input and output can be, however, in between the value can be much higher (causing clipping on the output if you don't decrease it)
check the split object for what you want, however, you might need to smooth out the data as well, or prevent excessive on and off switches (check speedlim, delay and gate)
I'm now trying to set three ranges (from 0-0.3 perform action1, from 0.3-0.7 perform action two, from 0.7-1.0 perform action3) but I still can't get it to work. Are you sure that the meter~ object sends out a value *between* 0 and 1, or send out a value that's either 0 *or* 1? I still struggle to get it to work.
I think this will help you:
also make sure you know the difference between floats and ints and signals in max and how these are handled
How can this be achieved for 4 audio inputs ? I've been trying but with no luck. Also, I want the output to stay at the current state and not just send the msg and go back to 0 again , according to Timo's example.. Any tips would be appreciated !
Is this what you mean?
Basically I want to change sound files (smoothly) depending on how noisy the environment is.
What I want to achieve is, if the in float number is X for at least 2 seconds then bang 1. If its is Z for 2 seconds then bang 2. etc..
I need to do this for four states. This is where I am now. But cant work it out.. Im messing around with the delay object but seems not to work. The patch is the following:
Thx for the response :)
Take a look at the sah~ object or maybe build something with a timer object and a if / then statement. But i think Timo already solved that for you?
Solved . :)
Thx a lot!
Hey guys, I'm working on a similar subpatch where the intensity of someone’s voice changes states based on the meter~ object’s 3 colours; green for speaking volume, orange for louder speech and red for shouting. I'm stuck over what parameters these 3 states should be set at based on the meter~ object’s parameters and how to carry on this change of state to other subpatches (e.g. one which adds or subtracts a certain amount of white noise to the incoming speech in 'real-time', going from none added to the normal speech (green) to a significant amount as someone shouts (red). Any light shed would be appreciated!
Cheers to Timo for his great advice and example. Definitely true when shaping control streams.