rudimentary peak detection – help!

Jul 27, 2008 at 2:07am

rudimentary peak detection – help!

Hello all,

I’m trying to detect simple peaks in a pfft~ by comparing the amplitudes of immediately neighboring samples (the one just before and the one just after): if the current sample’s amplitude is higher than its neighbors, the amplitude is passed, otherwise it is zeroed. I’m using count~ and three concurrent index~ objects in the main patch to do this. Yet – nothing’s happening. If anyone has a moment to look at this and offer any suggestions I’d be very grateful. Below is the main patch follwed by the pfft~ patch. Thanks,

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 46 282 29 9109513 +~ 1.;
#P newex 107 80 73 9109513 prepend read;
#P newex 81 131 62 9109513 mstosamps~;
#P flonum 133 158 49 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 42 33 28 9109513 open;
#P newex 42 56 79 9109513 sfinfo~;
#P newex 45 344 137 9109513 pfft~ extractpeaks_sub 1024 4;
#P flonum 68 376 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 45 398 33 9109513 *~ 0.2;
#P message 90 420 56 9109513 startwindow;
#P user ezdac~ 46 447 90 480 0;
#P newex 106 102 67 9109513 buffer~ sound;
#P message 91 179 26 9109513 stop;
#P button 70 179 15 0;
#P newex 45 311 63 9109513 index~ sound;
#P newex 107 311 63 9109513 index~ sound;
#P newex 171 283 27 9109513 -~ 1.;
#P newex 107 211 36 9109513 count~;
#P newex 171 310 63 9109513 index~ sound;
#P connect 14 0 13 0;
#P connect 18 0 4 0;
#P connect 4 0 12 0;
#P connect 12 0 10 0;
#P fasten 1 0 18 0 112 256 51 256;
#P connect 10 0 8 0;
#P fasten 9 0 8 0 95 442 51 442;
#P connect 11 0 10 1;
#P connect 10 0 8 1;
#P connect 13 3 16 0;
#P connect 17 0 7 0;
#P connect 13 5 17 0;
#P fasten 6 0 1 0 96 203 112 203;
#P fasten 5 0 1 0 75 202 112 202;
#P connect 1 0 3 0;
#P connect 3 0 12 1;
#P connect 16 1 15 0;
#P connect 15 0 1 1;
#P fasten 1 0 2 0 112 256 176 256;
#P connect 2 0 0 0;
#P connect 0 0 12 2;
#P window clipboard copycount 19;

==

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 126 142 27 9109513 +~;
#P newex 210 159 36 9109513 sig~ 0.;
#P newex 212 251 45 9109513 fftout~ 1;
#P newex 125 190 99 9109513 selector~ 2;
#P newex 104 107 27 9109513 < =~;
#P newex 302 111 27 9109513 >=~;
#P newex 212 222 46 9109513 poltocar~;
#P newex 320 72 46 9109513 cartopol~;
#P newex 213 72 46 9109513 cartopol~;
#P newex 104 72 46 9109513 cartopol~;
#P newex 319 41 40 9109513 fftin~ 3;
#P newex 215 41 40 9109513 fftin~ 2;
#P newex 105 43 40 9109513 fftin~ 1;
#P connect 2 1 5 1;
#P connect 2 0 5 0;
#P connect 5 0 7 1;
#P connect 4 0 8 1;
#P connect 4 0 9 1;
#P connect 4 0 7 0;
#P connect 1 1 4 1;
#P connect 6 1 10 1;
#P connect 11 0 9 2;
#P connect 1 0 4 0;
#P connect 6 0 10 0;
#P fasten 9 0 6 0 130 215 217 215;
#P fasten 7 0 12 1 307 135 148 135;
#P connect 0 1 3 1;
#P fasten 8 0 12 0 109 135 131 135;
#P connect 12 0 9 0;
#P connect 3 0 8 0;
#P connect 0 0 3 0;
#P window clipboard copycount 13;

==

#39009

You must be logged in to reply to this topic.