need a single bang from amplitude above 0

Wil's icon

situation:
i am trying send a single bang from a note with amplitude above zero. i am working with violin and orchestra bass.

Analyzer~ 'attack' works for sfz or heavy attacks. but i want to do volume crescendos starting from niente and crescendoing slowly. so i need to get a single bang from .001 or above then no more bangs until the amplitude goes back to zero.

i don't have an example cause so far everything is failing.

i tried using 'onebang' and this works as long as the occurrence of notes is slow and i manually reset the 'onebang' after the note finishes. but there is no way that i can manually 'onebang' the entire piece especially when the instruments are entering and exiting at different time, so i need this to be automated.

other things i have tried is setting fzero pitch detection to 0 so when a repeated note is played it will detect it, but it will not detect low amplitude and is inconsistent with the number of bangs it sends.

i tried using an if statement- if $f1 > 0. then 1 else 0 and use those bangs to reset the onebang but the 0 continuously bangs when the audio is turned on. (was using peak amp~ should try analyzer~ here)

so again, i need one single bang to be sent the moment the amplitude goes above 0 and no more bangs until AFTER the amplitude returns to 0 again and begins going up.

any takers?

Andro's icon

Use the past object
eg
past 0.9
Sends one bang out after 0.9 is passed and will only send out a bang again after the signal has dropped below 0.9 and above again.

Wil's icon

wow, been using max for about 5 years and feel like i know 1% of it. thanks!

Roman Thilenius's icon

|
[abs~]
|
[-~ 1.]
|
[zerox~]
|