Forums > MaxMSP

Reading peaks from a waveform

October 28, 2010 | 11:42 am

Hi there,
I’ve been working on this retarded patch the whole morning and I did all I need except for this little problem.
Here is a simplified version of the patch I’m working on.

1 / Just replace a sample into the buffer
2 / Toggle the [sig~]
3 / Change the number to move wherever you want on the sample and bang the [peakamp~].

From what I learned from the max help at this point the [peakamp~] should give me the amplitude value but most of the times it seems incorrect.

Do you have any idea about how to read peaks at specific points?

Thanks as always.

  1. wavereader.maxpat
October 28, 2010 | 11:50 am

Does this help? You’re using a millisecond value to check the peak values, and this won’t be sample-accurate, so will miss some peaks.

— Pasted Max Patch, click to expand. —
October 28, 2010 | 12:07 pm

Thanks Tim,
suddenly I thought that your solution was working correctly but I then figured out that I was having the same problems. It looks like a max problem but I don’t know how to explain it.
Try to put the attached file into the buffer for example. There are some empty parts in the loop which are read from the [peek~] and the [peakamp~] as well giving really strange values that looks non sense to me.

Anyway thanks for remembering me about the [peek~]. I didn’t like to use a [groove~] for that.

October 28, 2010 | 12:22 pm

The link to your .aif isn’t working. I have to go make some soup before I implode, but I’ll have a little think about it while I cook :) You’re not driving the [groove~ > peekamp~] and [peek~] with the same integer object are you? That would produce completely different results as one is ms and the other is samples.

October 28, 2010 | 12:43 pm

Hey I was wrong!
Your last message opened my eyes in some way!
I was using the same number to move the line on the [waveform~] and to control the [peek~] as well. But in order to match the visualization and the [peek~] output I had to multiply by 44.1 the number before going into the [peek~].
I’ve attached the final one.

Thanks Tim

  1. wavereader.maxpat
October 28, 2010 | 12:45 pm

By the way, have a nice lunch… or dinner.

October 28, 2010 | 7:25 pm

for peak by sample just use minimum and maximum …

October 28, 2010 | 8:16 pm

I don’t think degezo wants the "peak" value of the buffer, but rather the rectified amplitude value of a variable time point within the buffer.

(so in my comment object, I shouldn’t have put "peak sample value" because it isnt ;) )

Viewing 8 posts - 1 through 8 (of 8 total)

Forums > MaxMSP