How to get accurate amp val from pitch~ associated with attack detection?

    Jun 28 2010 | 11:03 pm
    I'm using pitch~ to find attacks. Works fine. But I also want to get a value that indicates how loud the attack was (relative to others). I tried printing the amplitude output value whenever the attack output says it found an attack, but the values I'm getting don't make sense. I've also got a flonum connected to the amp output and I can clearly see that there are much higher values passing by when an attack is detected, but that's not what I'm seeing. Perhaps I'm seeing an amplitude value that is earlier or later than the attack.
    Short version: is there any way to get the amplitude value from an attack that triggered the attack output of pitch~ to say it found one?

    • Jun 29 2010 | 4:45 am
      with more experimentation i've figured out that it appears that the peak amplitude value comes about 2 or 3 values after the pitch~ object detects an attack. can anyone think of a way i can grab the 3rd amplitude value after an attack detection?
    • Jun 29 2010 | 4:57 am
      I don't think you're going to find that setting a fixed rate is going to help you unless you're looking at a VERY limited set of possible audio inputs, but I may be misunderstanding your intention. Better to specify it more flexibly.
    • Jun 29 2010 | 5:15 am
      yes, i think you're right. i'm thinking of taking a snapshot of the amplitudes after the attack detection and finding the peak value. can't figure out how to do that yet, but the approach seems more sound.
    • Jun 30 2010 | 6:24 pm
      you could put the amplitude values (as floats) into [zl group], for as many as you want, then find the peak with [maximum]. Also look to [count~] perhaps.