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

Jun 28, 2010 at 11:03pm

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

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?

#51110
Jun 29, 2010 at 4:45am

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?

#183348
Jun 29, 2010 at 4:57am

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.

#183349
Jun 29, 2010 at 5:15am

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.

#183350
Jun 30, 2010 at 6:24pm

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.

#183351

You must be logged in to reply to this topic.