issues with "smoothness" of signal when using buffer?

Nov 7, 2006 at 11:51am

issues with "smoothness" of signal when using buffer?

Hello all

I am attempting to use a buffer (via peek objects) to “map” the ampitude of an incoming signal, and use its charactertics to drive another audio chain down the line…

basically (i hope this makes sense) i am using a snapshot~ object to take 50ms samples of the amplitude of a “live” signal, store it at 50ms intervals with a peek object, and have an output chain which uses another peek to pick up the samples, and lay them out via a line~ to recreate the original amplitude, but as control data of a sort…

im having this inescapable issue whereby the resultant amplitude continues to “waver” – ie im getting the basic mapped amplitude curve, but it flutters like crazy and isn’t smooth… its almost like in between every stored/accessed point of data it is inserting a zero value, which chops up the signal…

I dont know if im falling into a common issue in terms of storing to or accessing the buffer, or if perhaps i have not configured my line~ object correctly, but for the life of me i can’t work it out

i am a max novice, and have tried my darndest to resolve this by myself for the past many months… so im hoping the greater community may be inclined to chip in with some pointers…

the patch is below, it wont work in isolation as its driven by a sort of gate that triggers the buffer process based on the level of incoming signal, but hopefully if im doing something stuipd it will show up visually

many thanks to those who take the time to look at this and help out

cheers

max v2;
#N vpatcher 16 58 697 741;
#P origin -100 13;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 219 267 43 196617 route 0;
#P button 219 343 15 0;
#P message 172 287 14 196617 1;
#P newex 171 242 40 196617 change;
#P newex 171 267 43 196617 route 1;
#P newex 172 306 37 196617 pipe 5;
#P newex 219 413 62 196617 metro 50;
#N counter 1000;
#X flags 0 0;
#P newobj 219 435 100 196617 counter 1000;
#P message 219 363 14 196617 0;
#P toggle 219 383 15 0;
#P window linecount 6;
#P comment 16 289 100 196617 if the buffer playback (autocounting) reaches 999 then this bangs counter to 0 and stops metro;
#P window linecount 1;
#P newex 121 306 44 196617 sel 999;
#P user panel 10 282 159 85;
#X brgb 71 193 209;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P hidden newex 260 477 76 196617 s playbckcount;
#P window linecount 7;
#P comment 130 512 85 196617 This concerns playback of the buffer , seperate ramp when setting to 0. rest is 50 ms between samples;
#P window linecount 1;
#P message 284 533 37 196617 $1 50;
#P newex 284 625 32 196617 line~;
#P button 263 564 15 0;
#N comlet Signal Output;
#P outlet 332 653 15 0;
#P user meter~ 321 628 401 641 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P newex 219 563 40 196617 unpack;
#P message 219 540 34 196617 0. 50;
#P newex 219 509 32 196617 sel 0;
#P number 219 478 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 284 512 74 196617 peek~ resynth;
#P user panel 125 465 246 150;
#X brgb 37 144 86;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 322 -8 40 196617 change;
#P window linecount 13;
#P comment 1 40 151 196617 When on message received: clear buffer , start metro , send on message to peekbuffcommands When off message received: set counter to 0 , stop metro send off message to peekbuffcommands But if the playback (output counter) sits on 0: on message: starts metro , sends message to peekbuff commands off massage: stops metro , sends to peekbuff commands;
#P window linecount 1;
#P comment 452 169 64 196617 Sig of filter;
#P flonum 314 232 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 333 211 43 196617 route 0;
#P hidden button 673 18 15 0;
#P hidden newex 673 -5 38 196617 sel 52;
#P hidden newex 672 -27 40 196617 key;
#P hidden message 717 -8 33 196617 front;
#N thispatcher;
#Q end;
#P hidden newobj 717 11 61 196617 thispatcher;
#P window linecount 2;
#P comment 486 136 27 196617 Sig in;
#P number 420 -13 49 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 420 8 49 196617 < 1;
#P newex 230 44 29 196617 gate;
#P window linecount 2;
#P comment 331 70 100 196617 clear counter if under level;
#P button 230 66 15 0;
#P button 322 99 15 0;
#P window linecount 1;
#P newex 249 10 32 196617 sel 1;
#P newex 322 12 32 196617 sel 0;
#P newex 333 192 51 196617 pack 0 0.;
#P user meter~ 391 142 471 155 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P message 230 84 33 196617 clear;
#P newex 218 141 52 196617 metro 50;
#P toggle 249 -43 15 0;
#N comlet Trigger Input;
#P inlet 249 -63 15 0;
#N comlet Signal in;
#P inlet 374 141 15 0;
#P message 322 127 14 196617 0;
#P number 218 204 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N counter 1000;
#X flags 0 0;
#P newobj 218 166 70 196617 counter 1000;
#P newex 374 168 69 196617 snapshot~ 50;
#P window linecount 2;
#P newex 230 106 69 196617 buffer~ resynth 1000;
#P window linecount 1;
#P newex 365 231 74 196617 peek~ resynth;
#P window linecount 2;
#P comment 274 -50 100 196617 Input over/under trigger level;
#P comment 255 205 45 196617 counter setting;
#P window linecount 7;
#P comment 472 -17 99 196617 output counter setting acts as a block for resetting of buffer , if on 0 then ok to reset , if still in progress then blocks reset;
#P user panel 237 -66 155 50;
#X brgb 211 255 157;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 370 129 156 61;
#X brgb 247 1 168;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P fasten 39 0 51 0 224 495 118 495 118 300 126 300;
#P fasten 13 0 59 0 254 -5 176 -5;
#P connect 59 0 58 0;
#P connect 58 0 60 0;
#P connect 60 0 57 0;
#P fasten 13 0 14 0 254 5 223 5 223 104 223 104;
#P connect 14 0 8 0;
#P connect 8 0 9 0;
#P fasten 59 0 62 0 176 264 224 264;
#P connect 62 0 61 0;
#P fasten 51 0 61 0 126 330 224 330;
#P connect 61 0 54 0;
#P connect 54 0 53 0;
#P fasten 53 0 56 0 224 408 224 408;
#P fasten 57 0 56 0 177 394 224 394;
#P connect 56 0 55 0;
#P connect 55 0 39 0;
#P connect 39 0 40 0;
#P connect 40 0 41 0;
#P connect 41 0 42 0;
#P fasten 24 0 23 0 425 35 235 35;
#P connect 23 0 21 0;
#P connect 21 0 15 0;
#P connect 15 0 6 0;
#P connect 12 0 13 0;
#P fasten 13 0 19 0 254 -8 254 -8;
#P connect 19 0 23 1;
#P hidden connect 39 0 49 0;
#P fasten 10 0 8 3 327 160 268 160;
#P fasten 41 0 45 0 224 559 268 559;
#P fasten 55 0 38 0 224 456 358 456 358 501 289 501;
#P connect 38 0 47 0;
#P fasten 42 0 46 0 224 598 289 598;
#P connect 47 0 46 0;
#P fasten 9 0 55 3 223 258 290 258;
#P fasten 54 0 55 3 224 380 290 380;
#P fasten 42 1 46 1 254 618 311 618;
#P fasten 32 0 33 0 335 228 319 228;
#P connect 46 0 43 0;
#P fasten 13 0 36 0 254 -13 327 -13;
#P connect 36 0 18 0;
#P connect 18 0 20 0;
#P connect 20 0 10 0;
#P connect 46 0 44 0;
#P fasten 8 0 17 0 223 187 338 187;
#P connect 17 0 32 0;
#P fasten 32 1 5 0 370 226;
#P connect 11 0 7 0;
#P connect 7 0 17 1;
#P hidden connect 11 0 16 0;
#P fasten 55 0 25 0 224 456 621 456 621 -31 425 -31;
#P connect 25 0 24 0;
#P hidden connect 29 0 30 0;
#P hidden connect 30 0 31 0;
#P hidden connect 31 0 28 0;
#P hidden connect 28 0 27 0;
#P pop;

#28565
Nov 7, 2006 at 12:12pm

Haven’t had the chance to check out your example, but it soundt like it would be a better idea to record the envelope with

adc~
I
average~ 50 (in absolute mode)
I
record~ envelope

then use index~ to playback the control information…

This method will keep the date entirely in signal domain ;)

…not sure if this is what you meant though… i can post en example later..

#87876
Nov 7, 2006 at 1:23pm

i couldnt really follow what you were trying to do, but i have attached a patch which is part of some audio analysis patches i use… which work fine for me!

from what i can see part of your problem might be coming from the analysis not being based on absolute values. but i dont know if that might be part of what you actually want!

anyway, hopefully the patch below will illustrate another way of approaching the idea… you need an audio input source (i was using a drum machine), or replace relevant part of patch with sfplay~.

justin

max v2;
#N vpatcher 106 44 1021 795;
#P origin -100 -75;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 701 304 185 196617 < < absolute values which could be recorded to buffer.;
#P comment 611 219 185 196617 < < this patch analyses audio to generate the RMS (i think!) of the audio level.;
#P user scope~ 359 244 489 374 512 3 128 -1. 1. 0 0. 0 0. 255 0 0 0 0 0 0;
#P window linecount 1;
#P comment 545 592 243 196617 make some silly acid noises from the audio analysis;
#P comment 640 406 122 196617 trigger threshold for amp;
#P window linecount 2;
#P comment 358 418 122 196617 generate some notes when amp triggered;
#P window linecount 1;
#P newex 359 457 40 196617 change;
#P newex 359 608 57 196617 pack 0. 30;
#P newex 359 627 32 196617 line~;
#P newex 359 540 71 196617 prepend nth 0;
#P flonum 604 406 35 9 0. 0.99 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 359 588 31 196617 mtof;
#P newex 359 476 32 196617 sel 1;
#P newex 359 496 52 196617 random 4;
#N coll ;
#T flags 1 0;
#T 0 42 41 38 50;
#P newobj 359 566 53 196617 coll;
#P newex 570 462 41 196617 * 0.25;
#P number 581 107 35 9 1 50 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 570 425 15 0;
#P flonum 519 498 35 9 0. 0.99 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 570 406 33 196617 > 0.2;
#P newex 509 456 50 196617 *~ 8000;
#P newex 509 475 37 196617 +~ 20;
#P newex 449 517 70 196617 svf~ 500 0.5;
#P newex 545 546 35 196617 *~ 0.;
#P newex 570 486 51 196617 pack 0. 5;
#P newex 570 505 32 196617 line~;
#P toggle 270 32 15 0;
#P comment 286 32 152 196617 play noiz controlled by analysis;
#P newex 270 68 35 196617 gate~;
#P newex 295 48 91 196617 receive~ bassnoiz;
#P newex 545 573 77 196617 send~ bassnoiz;
#P newex 449 457 58 196617 saw~ 73.4;
#P hidden newex 642 127 40 196617 unpack;
#P hidden newex 642 106 81 196617 loadmess 5 100;
#P number 603 195 35 9 0 1000 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 569 195 35 9 0 500 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 539 107 15 0;
#P newex 539 128 52 196617 metro 20;
#N vpatcher 28 75 401 464;
#N comlet signal;
#P outlet 64 344 15 0;
#N comlet ms smooth down;
#P inlet 258 107 15 0;
#N comlet ms smooth up;
#P inlet 204 107 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 95 299 50 196617 clip 0. 1.;
#P flonum 258 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 271 160 66 196617 mstosamps~;
#P flonum 204 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 204 160 66 196617 mstosamps~;
#P newex 95 278 55 196617 snapshot~;
#P newex 95 204 29 196617 sig~;
#P newex 95 245 242 196617 slide~ 220.5 2205.;
#P newex 95 73 27 196617 *~;
#N comlet float;
#P outlet 95 344 15 0;
#N comlet bang to report values;
#P inlet 185 107 15 0;
#N comlet audio to analysis;
#P inlet 95 27 15 0;
#P window linecount 0;
#P newex 95 184 77 196617 expr sqrt($f1);
#P newex 95 156 55 196617 snapshot~;
#P fasten 6 0 16 0 100 270 69 270;
#P connect 2 0 5 0;
#P fasten 3 0 0 0 190 143 100 143;
#P connect 5 0 0 0;
#P connect 0 0 1 0;
#P connect 1 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 8 0;
#P fasten 3 0 8 0 190 272 100 272;
#P connect 8 0 13 0;
#P connect 13 0 4 0;
#P connect 2 0 5 1;
#P connect 14 0 10 0;
#P connect 10 0 9 0;
#P connect 9 1 6 1;
#P connect 15 0 12 0;
#P fasten 12 0 11 0 263 154 276 154;
#P connect 11 1 6 2;
#P pop;
#P newobj 509 219 100 196617 p amp-analiza;
#P user multiSlider 599 304 100 100 0. 1. 1 3449 15 0 0 2 0 0 0;
#M frgb 255 255 255;
#M brgb 0 0 0;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P noclick;
#P user scope~ 183 244 313 374 512 3 128 -1. 1. 0 0. 0 0. 255 0 0 0 0 0 0;
#P user number~ 72 206 155 221 9 3 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user meter~ 183 229 263 242 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P user scope~ 52 244 182 374 512 3 128 -1. 1. 0 0. 0 0. 255 0 0 0 0 0 0;
#P toggle 148 32 15 0;
#P newex 213 95 35 196617 gate~;
#P newex 177 95 35 196617 gate~;
#P user ezdac~ 177 128 221 161 0;
#P toggle 13 59 54 0;
#P newex 103 116 41 196617 *~ 0.5;
#P newex 103 95 27 196617 +~;
#P user ezadc~ 103 32 147 65 0;
#N vpatcher 0 44 825 825;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 226 362 43 196617 route 0;
#P button 226 438 15 0;
#P message 179 382 14 196617 1;
#P newex 178 337 40 196617 change;
#P newex 178 362 43 196617 route 1;
#P newex 179 401 37 196617 pipe 5;
#P newex 226 508 62 196617 metro 50;
#N counter 1000;
#X flags 0 0;
#P newobj 226 530 100 196617 counter 1000;
#P message 226 458 14 196617 0;
#P toggle 226 478 15 0;
#P window linecount 6;
#P comment 23 384 100 196617 if the buffer playback (autocounting) reaches 999 then this bangs counter to 0 and stops metro;
#P window linecount 1;
#P newex 128 401 44 196617 sel 999;
#P user panel 17 377 159 85;
#X brgb 71 193 209;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P hidden newex 267 572 76 196617 s playbckcount;
#P window linecount 7;
#P comment 137 607 85 196617 This concerns playback of the buffer , seperate ramp when setting to 0. rest is 50 ms between samples;
#P window linecount 1;
#P message 291 628 37 196617 $1 50;
#P newex 291 720 32 196617 line~;
#P button 270 659 15 0;
#N comlet Signal Output;
#P outlet 339 748 15 0;
#P user meter~ 328 723 408 736 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P newex 226 658 40 196617 unpack;
#P message 226 635 34 196617 0. 50;
#P newex 226 604 32 196617 sel 0;
#P number 226 573 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 291 607 74 196617 peek~ resynth;
#P user panel 132 560 246 150;
#X brgb 37 144 86;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 329 87 40 196617 change;
#P window linecount 13;
#P comment 8 135 151 196617 When on message received: clear buffer , start metro , send on message to peekbuffcommands When off message received: set counter to 0 , stop metro send off message to peekbuffcommands But if the playback (output counter) sits on 0: on message: starts metro , sends message to peekbuff commands off massage: stops metro , sends to peekbuff commands;
#P window linecount 1;
#P comment 459 264 64 196617 Sig of filter;
#P flonum 321 327 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 340 306 43 196617 route 0;
#P hidden button 680 113 15 0;
#P hidden newex 680 90 38 196617 sel 52;
#P hidden newex 679 68 40 196617 key;
#P hidden message 724 87 33 196617 front;
#N thispatcher;
#Q end;
#P hidden newobj 724 106 61 196617 thispatcher;
#P window linecount 2;
#P comment 493 231 27 196617 Sig in;
#P number 427 82 49 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 427 103 49 196617 < 1;
#P newex 237 139 29 196617 gate;
#P window linecount 2;
#P comment 338 165 100 196617 clear counter if under level;
#P button 237 161 15 0;
#P button 329 194 15 0;
#P window linecount 1;
#P newex 256 105 32 196617 sel 1;
#P newex 329 107 32 196617 sel 0;
#P newex 340 287 51 196617 pack 0 0.;
#P user meter~ 398 237 478 250 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P message 237 179 33 196617 clear;
#P newex 225 236 52 196617 metro 50;
#P toggle 256 52 15 0;
#N comlet Trigger Input;
#P inlet 256 32 15 0;
#N comlet Signal in;
#P inlet 381 236 15 0;
#P message 329 222 14 196617 0;
#P number 225 299 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N counter 1000;
#X flags 0 0;
#P newobj 225 261 70 196617 counter 1000;
#P newex 381 263 69 196617 snapshot~ 50;
#P window linecount 2;
#P newex 237 201 69 196617 buffer~ resynth 1000;
#P window linecount 1;
#P newex 372 326 74 196617 peek~ resynth;
#P window linecount 2;
#P comment 281 45 100 196617 Input over/under trigger level;
#P comment 262 300 45 196617 counter setting;
#P window linecount 7;
#P comment 479 78 99 196617 output counter setting acts as a block for resetting of buffer , if on 0 then ok to reset , if still in progress then blocks reset;
#P user panel 244 29 155 50;
#X brgb 211 255 157;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 377 224 156 61;
#X brgb 247 1 168;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P fasten 39 0 51 0 231 590 125 590 125 395 133 395;
#P fasten 13 0 59 0 261 90 183 90;
#P connect 59 0 58 0;
#P connect 58 0 60 0;
#P connect 60 0 57 0;
#P fasten 13 0 14 0 261 100 230 100 230 199 230 199;
#P connect 14 0 8 0;
#P connect 8 0 9 0;
#P fasten 59 0 62 0 183 359 231 359;
#P connect 62 0 61 0;
#P fasten 51 0 61 0 133 425 231 425;
#P connect 61 0 54 0;
#P connect 54 0 53 0;
#P fasten 53 0 56 0 231 503 231 503;
#P fasten 57 0 56 0 184 489 231 489;
#P connect 56 0 55 0;
#P connect 55 0 39 0;
#P connect 39 0 40 0;
#P connect 40 0 41 0;
#P connect 41 0 42 0;
#P fasten 24 0 23 0 432 130 242 130;
#P connect 23 0 21 0;
#P connect 21 0 15 0;
#P connect 15 0 6 0;
#P connect 12 0 13 0;
#P fasten 13 0 19 0 261 87 261 87;
#P connect 19 0 23 1;
#P hidden connect 39 0 49 0;
#P fasten 10 0 8 3 334 255 275 255;
#P fasten 41 0 45 0 231 654 275 654;
#P fasten 55 0 38 0 231 551 365 551 365 596 296 596;
#P connect 38 0 47 0;
#P fasten 42 0 46 0 231 693 296 693;
#P connect 47 0 46 0;
#P fasten 9 0 55 3 230 353 297 353;
#P fasten 54 0 55 3 231 475 297 475;
#P fasten 42 1 46 1 261 713 318 713;
#P fasten 32 0 33 0 342 323 326 323;
#P connect 46 0 43 0;
#P fasten 13 0 36 0 261 82 334 82;
#P connect 36 0 18 0;
#P connect 18 0 20 0;
#P connect 20 0 10 0;
#P connect 46 0 44 0;
#P fasten 8 0 17 0 230 282 345 282;
#P connect 17 0 32 0;
#P fasten 32 1 5 0 377 321;
#P connect 11 0 7 0;
#P connect 7 0 17 1;
#P hidden connect 11 0 16 0;
#P fasten 55 0 25 0 231 551 628 551 628 64 432 64;
#P connect 25 0 24 0;
#P hidden connect 29 0 30 0;
#P hidden connect 30 0 31 0;
#P hidden connect 31 0 28 0;
#P hidden connect 28 0 27 0;
#P pop;
#P newobj 52 152 61 196617 p resbuffer;
#P comment 164 32 100 196617 playthru output;
#P comment 569 180 122 196617 smooth control data (ms);
#P connect 6 0 2 0;
#P connect 2 0 11 0;
#P connect 2 0 13 0;
#P hidden fasten 3 0 4 0 108 80 108 80;
#P connect 4 0 5 0;
#P connect 5 0 2 1;
#P hidden fasten 3 1 4 1 142 80 125 80;
#P hidden fasten 10 0 8 0 153 71 182 71;
#P fasten 26 0 7 0 275 121 182 121;
#P connect 8 0 7 0;
#P hidden fasten 5 0 12 0 108 181 188 181;
#P hidden fasten 5 0 14 0 108 188 188 188;
#P hidden fasten 3 0 8 1 108 80 207 80;
#P fasten 26 0 7 1 275 124 216 124;
#P connect 9 0 7 1;
#P hidden fasten 10 0 9 0 153 71 218 71;
#P hidden fasten 3 1 9 1 142 80 243 80;
#P hidden connect 21 0 28 0;
#P connect 28 0 26 0;
#P connect 25 0 26 1;
#P fasten 16 0 52 0 514 240 364 240;
#P fasten 37 0 48 0 575 444 364 444;
#P connect 48 0 42 0;
#P connect 42 0 41 0;
#P connect 41 0 45 0;
#P connect 45 0 40 0;
#P connect 40 0 43 0;
#P connect 43 0 47 0;
#P connect 47 0 46 0;
#P fasten 46 0 23 0 364 652 439 652 439 449 454 449;
#P connect 23 0 32 0;
#P connect 33 0 32 1;
#P hidden fasten 5 0 16 0 108 179 514 179;
#P connect 16 0 34 0;
#P connect 34 0 33 0;
#P connect 36 0 32 2;
#P hidden connect 21 0 18 0;
#P connect 18 0 17 0;
#P connect 17 0 16 1;
#P fasten 32 2 31 0 494 540 550 540;
#P connect 31 0 24 0;
#P hidden connect 22 0 19 0;
#P connect 19 0 16 2;
#P fasten 16 1 35 0 604 242 575 242;
#P connect 35 0 37 0;
#P connect 37 0 39 0;
#P connect 39 0 30 0;
#P connect 30 0 29 0;
#P connect 29 0 31 1;
#P connect 38 0 17 1;
#P connect 44 0 35 1;
#P connect 20 0 16 3;
#P connect 16 1 15 0;
#P hidden connect 22 1 20 0;
#P hidden connect 21 0 22 0;
#P pop;

#87877
Nov 8, 2006 at 10:00am

Hi,

The problem is simple. You take a reading of the instantaneous amplitude at regular intervals, which means that you reading is arbitary with respect to the input signal. If you imagine that the waveform coming in is oscillating back and forth across zero (as audio waveforms tned to do) then imagine picking a random point on it, it is clear that you might get a zero, or near zero value, even at a point where the perceived volume is very loud.

The solution is to use envelope following (track the overall volume of the input, rather than individual sample values). There are a bunch of ways you could do this, and some of the suggestions above would be worth a look, but in terms of modifying your patch, try replacing the [snapshot~] with a [peakamp~] which will give you the largest instanteous sample value between two write times, rather than an arbitrary one. That should follow the input more effectively in terms of envelope.

On a more general note, it’s worth including full patches when posting to the list, as your post (at least the text one) doesn’t give any indicating of what happens to the signal before it reaches this subpatch, which could be quite important…..

Regards,

Alex

#87878
Nov 9, 2006 at 12:49pm

Thank you for your help everybody

Ive been tinkering for the last while trying to make this work well

Alex, I knew there must be someting simple like that- once i saw your explanation I realised one of the big mistakes Ive been making.

I replaced snapshot with peakamp, which has helped somewhat, but not completely resolved the issue.

Ive tried putting a average in absoute mode in front of that, and have been mucking around with settings for that. Is there any point in doing this? I guess I was hoping on using the average~ to even out any major flutters in the signal, making it easier for the peakamp~ to find a sample set that is more consistent with the spirit of the overall amplitude…

i really dont understand what im saying here too well, my understanding is somewhat peripheral…

perhaps in terms of getting a more “averaged” result I should increase my sample interval and metro settings to someting more like 100-500ms? if the resultant data is fed to a line~ in the end this shouldnt be an issue in terms of getting a general indication of the amplitude character, should it?

I am probably not making a lot of sense here! late night with new baby in the house, frantically trying to make time for my patch…

thanks again all

#87879
Nov 9, 2006 at 2:32pm

dunno if you had time to look at the patch i posted… in my amp analysis patch, there is a slide~ object which i use to smooth out the resulting analysis.

only thing is it’s signal based, so u have to convert your float from peakamp back to sig~ then into slide~.

you could keep things in the max domain by using line, but the advantage of slide~ is that you can control the up / down smooth factor. this is better illustrated by the patch, particularly the multislider which is used to display the analysis result…

j

#87880
Nov 10, 2006 at 10:42am

thanks justin…

i did have a look and now im heving a better look! trying to suss what it is you are doing there, i will have to look into the slide object futher…

i hope to understand it better some time soon… i think i can see whats going on there though

cheers

#87881
Feb 16, 2007 at 5:46am

thought id just say thanks again to all who helped with this one – justin your patch really helped once i got to the heart of it

resolved this one – (after throwing out 6 months of work and starting again on better founded ideas)

very much appreciate the input of the max community – nice one guys and gals!

cheers

#87882

You must be logged in to reply to this topic.