Reading peaks from a waveform

Oct 28, 2010 at 11:42am

Reading peaks from a waveform

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.

Attachments:
  1. wavereader.maxpat
#52970
Oct 28, 2010 at 11:50am

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. –
#190516
Oct 28, 2010 at 12:07pm

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.

#190517
Oct 28, 2010 at 12:22pm

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.

#190518
Oct 28, 2010 at 12:43pm

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

Attachments:
  1. wavereader.maxpat
#190519
Oct 28, 2010 at 12:45pm

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

#190520
Oct 28, 2010 at 7:25pm

for peak by sample just use minimum and maximum …

#190521
Oct 28, 2010 at 8:16pm

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 ;) )

#190522

You must be logged in to reply to this topic.