find maximum in a signal period

ring's icon

Hey guys,

can anyone give me a hint how I could find the maximum in a certain number of samples? Lets say I want to get always the highest value of the last 2048 samples...

As far as I realize maximum~, peakamp~ and minmax~ won't work.
I would want to avoid to use jitter or ftm as I want to stay in the signal domain.

thanks,
simon

EMV's icon

why does peakamp~ not work?

you can use sampstoms to convert from samples to ms and insert that into the right input of peakamp to trigger every period and output the maximum.

ring's icon

1. I don't know for sure, but I think that if you want to calculate in samples and you use objects that deal with ms it gets something incorrect, isn't it?!

2. the peakamp outputs one value every x ms. But I need to get a signal output giving me the peak of a stream of the last x samples.

EMV's icon

The method I described circumvents the fact that peakamp doesn't take an argument in samples.

However, peakamp~ doesn't take a float input for the reporting interval, depending on your application this may or may not be a problem.
(at a sample rate of 44.1 KHz, 2048 samples is 46.440 ms, peakamp~ would then be reporting every 46 ms, aka every 2029 samples)

If you want a running stream instead of an interval, you are right that you need something else.