max v2; #N vpatcher 101 61 887 690; #P window setfont "Fixedwidth Serif" 18.; #P message 310 92 53 1441810 open; #P comment 575 242 108 1441810 threshold; #P comment 497 334 53 1441810 gain; #P toggle 136 498 15 0; #P newex 255 481 31 1441810 *~; #P newex 206 481 31 1441810 *~; #P newex 387 421 64 1441810 line~; #P newex 206 514 59 1441810 dac~; #P flonum 430 332 67 18 0. 0 1 22 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 387 356 53 1441810 * 1.; #P toggle 387 321 32 0; #P newex 387 294 74 1441810 change; #P flonum 496 241 74 18 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 387 266 119 1441810 >= 0.03125; #P newex 387 391 119 1441810 pack 0. 20; #P number 507 170 53 18 0 0 1 22 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 387 198 130 1441810 peakamp~ 20; #P newex 310 29 97 1441810 loadbang; #P message 129 58 19 1441810 1; #P message 85 58 19 1441810 0; #P message 310 57 251 1441810 open GateTestSound.aif; #P toggle 206 38 15 0; #P message 206 58 86 1441810 loop \$1; #N sfplay~ 2 120960 0 ; #P newobj 206 123 108 1441810 sfplay~ 2; #P comment 87 515 119 1441810 DSP on/off; #P comment 64 38 108 1441810 stop/play; #P comment 422 150 240 1441810 polling interval (ms); #P comment 369 460 383 1441810 Measure the peak amplitude every 20 milliseconds. If it passes above the threshold \, turn the gain up \, and if it passes below the threshold \, turn the gain down.; #P comment 461 296 207 1441810 filter out repeats; #P connect 7 0 6 0; #P connect 28 0 5 0; #P connect 6 0 5 0; #P connect 8 0 5 0; #P connect 10 0 5 0; #P connect 9 0 5 0; #P connect 5 0 23 0; #P connect 23 0 21 0; #P connect 25 0 21 0; #P connect 22 0 23 1; #P connect 5 1 24 0; #P connect 24 0 21 1; #P connect 22 0 24 1; #P connect 11 0 8 0; #P connect 5 0 12 0; #P connect 12 0 15 0; #P connect 15 0 17 0; #P connect 17 0 18 0; #P connect 18 0 19 0; #P connect 19 0 14 0; #P connect 14 0 22 0; #P connect 20 0 19 1; #P connect 16 0 15 1; #P fasten 13 0 14 1 512 194 573 194 573 387 501 387; #P connect 13 0 12 1; #P pop;