Reading peaks from a waveform
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.
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.
----------begin_max5_patcher---------- 733.3oc2XErbaBCD8L9qPCmoYPBCF2Ccl9czwSGY7FrR.IFP3jzLIe6UHASH oNxXWiNDePxrHg28su8o077BO+shGgFez2Q+B4487BOOsoNCd8W64WReLqf1 nWlelnrD3R+.y8jviRs8eX9LXm2Vx3EfTuI7aFEsxAqg8VuUvkMr+.5URtYv bEUlsmwy+cMjIMdXDNVcazxD8TRX2HQMh1zuG1NsuH1d22hh7G874zR8y2+m 0LZge2MdYwhtgf+y3tsAPMzxpB.cfVzBHo.ksGxtGUAz6M1F1TAiCYhVtdmj 4DoHXM3rLUOgiwcSQK+DnB6FnRTGfJE0.hlk0VSkPwS9t.DLzELNxFegj5FP fV7.8oFTMHaq4nJQCSxN.yJNrLxT1r1fCjDq3PravAc0w3BGW.Awjdp.1JDb kkN3vCpG6+xD11fBu4LBar8v1rR4SUfIl8usPPU+TarHntZLyXo8BjP2PLdm XJiOuzhXiBggcrdos3GekEHTYGk6eFgG4hR+AH+sTd9TnA8UGwVOWEek0GTw 3VndFgAF+r.gdtf4hOEDvNQgnBf6eEIgF4QwmHGqRz21k0iObzonM.eGRtuS fPFz8ENpKAq64Roe75rpZfiFyTvqI1.jUNgoHQaQrYrHRW8DXJlrQUvgiglH xMweNx7UUHY.CBmfZZZx0EDjh77B3B5o3nQqUQgTcFNckdJZX7nI53qHSugk +5L1yj5wyUP+oi7AJt8dlR951yfFEhiiNMImPbhFXdsPb.N6yKIWFCI3b3JI 5oUqr1SQhi5ovxIjDW0Qgg7PzmblXGVlFpn2p9Er7g2lk9Wuy96gpFQac1fC O72aPu4A6TjHFmJYB9nE0076nEsmsaGvG2DQIaWkPIc16DnMGMwMUeJcBtzG 7641k5578j9TpSco3oj3btGgOkGk3VpTxDPI2xtmBSp6nCWl3lBWh31LGYJY NGylvIybMm5hWV7WhoKtf. -----------end_max5_patcher-----------
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.
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.
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.
By the way, have a nice lunch… or dinner.
for peak by sample just use minimum and maximum …
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 ;) )