| From | Sent On | Attachments |
|---|---|---|
| ypatios | Feb 9, 2010 2:21 am | |
| IOhannes m zmoelnig | Feb 9, 2010 2:31 am | |
| IOhannes m zmoelnig | Feb 9, 2010 3:02 am | .zip |
| Frank Barknecht | Feb 9, 2010 3:22 am | |
| Matt Barber | Feb 9, 2010 6:48 am | |
| William Brent | Feb 9, 2010 6:13 pm | |
| ypatios | Feb 14, 2010 7:05 pm | |
| Frank Barknecht | Feb 19, 2010 1:01 am | .tgz |
| Chris McCormick | Feb 19, 2010 4:08 am |
| Subject: | Re: [PD] peak amplitude in pd vanilla (was: [env~ ] vs [vsnapshot~ ]: which one is more cpu consuming?) | |
|---|---|---|
| From: | Matt Barber (brbr...@gmail.com) | |
| Date: | Feb 9, 2010 6:48:14 am | |
| List: | at.iem.pd-list | |
As I understand it (and hopefully i am not completely wrong..) you don't have to 'store' a list and 'then' read again it to find the max magnitude. It's as simple as the following:
(some signal) *I* *I* [pd metro@samplerate] *I*/ [vsnapshot~ ] | [abs ] | [moses ]X[t f ] | [f ]
I think I may have misunderstood your task earlier. In any case, you'll probably still do what you want more efficiently at the signal level:
---------------------------------------------------
[inlet~] [block~ 1] | [abs~] [delread~ $0-compare 0] | / | / [max~] |\ | \ | [delwrite~ $0-compare 1] | [outlet~]
---------------------------------------------------
The [delread~] should be a one-sample delay, so you're just comparing the previous maximum with the current sample and outputting the larger of the two. Then on the outside you can poll that with snapshot~ periodically just like you did your float object above. If you need to reset it, I think you can just have the [delread~] feed into a [*~] with a [line~] that jumps from 1 to 0 and back to 1. Use [switch~ 1] instead of [block~ 1] if you want to be able to test the cpu load from that patch. I hope this works.
I don't think that [env~] does what you want it to at all.
Matt
_______________________________________________
Pd-l...@iem.at mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list






.zip