how to 'define' a level-range of a mic to operate with input values..?

    Nov 03 2013 | 8:50 pm
    hi folks! i'm quite new to max and hope that there's a solution for my little problem here.
    what i want to do: i would like to 'use' the input level of a microphone to trigger certain events. the idea was to define a level-range to get a bang, if the signal exceeds/underruns a defined value over a certain period of time. so, if the input level is higher than a defined value for - let's say - 30 seconds, i need a bang. otherwise, if the input level is lower than the value, i need a bang.
    what i already tried: to get some adequate values from the mic, i multiplied the values from the meter with 10000.1 - so i got values somewhere between 0 and 9999 and sent them to a gain-slider (just to have some kind of display). now the idea was to use the 'speedlim'-command, to get some values over a certain period of time. i defined 5 points (1,3,5,10 and 20 seconds) and combined each of them with an 'if' command, in order to send a message, if the incoming value exceeded a defined value [if $i1 > 450 then 1]. the sent messages i used where just '1', '2', '3', and so on because afterwards i wanted to use the 'match'-command [match 1 2 3 4 5] to synchronize the 5 values, in order to get one last bang if all the values (after 20 seconds) would be high enough.
    it seems, that the 'match'-command here is not the best choice, because it only triggers if the numbers to look for are in the proper order. and, as the first speedlim-command interrogates the values every second, there can not be a proper order from 1-5.
    maybe i am thinking too complicated at all. for me it's important to get this patch working as accurately as possible. the more value-retrievals from the mic, the better. the program should only trigger, if all the values (over a certain period) exceed the defined value. any suggestions anyone? is there maybe a command which works like 'match' but disregards the order of the numbers or something?
    best regards, peter

    • Nov 03 2013 | 9:49 pm
      I might approach this problem like this (paste into max patch):
    • Nov 04 2013 | 9:53 pm
      thanks so much! this helps a lot:)