Update of /cvsroot/pure-data/pd/doc/3.audio.examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24040/doc/3.audio.examples
Added Files: D13.additive.qlist.pd D14.vibrato.pd H01.low-pass.pd H02.high-pass.pd H03.band-pass.pd H04.filter.sweep.pd H05.filter.floyd.pd H06.envelope.follower.pd H07.measure.spectrum.pd H08.heterodyning.pd H09.ssb.modulation.pd H10.measurement.pd H11.shelving.pd H12.peaking.pd H13.butterworth.pd H14.all.pass.pd H15.phaser.pd H16.adsr.filter.qlist.pd I01.Fourier.analysis.pd I02.Hann.window.pd I03.resynthesis.pd I04.noisegate.pd I05.compressor.pd I06.timbre.stamp.pd I07.phase.vocoder.pd I08.pvoc.reverb.pd I09.sheep.from.goats.pd I10.phase.bash.pd J01.even.odd.pd J02.trapezoids.pd J03.pulse.width.mod.pd J04.corners.pd J05.triangle.pd J06.enveloping.pd J07.oversampling.pd J08.classicsynth.pd J09.bandlimited.pd buttercoef3.pd butterworth3~.pd filter-graph1.pd filter-graph2.pd Log Message: Added about 64 files that I hadn't realized weren't in the CVS repository. Threw in pd/portaudio/pa_win_wdmks for good measure, although I haven't tried compiling that in yet (no windoze machine handy today).
--- NEW FILE: H05.filter.floyd.pd --- #N canvas 708 41 555 646 12; #N canvas 0 0 600 392 conversion-tables 0; #N canvas 0 0 450 300 graph1 0; #X array dbtorms 123 float 1; #A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05 2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05 4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05 8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828 0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813 0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946 0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489 0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813 0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328 0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526 0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684 0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202 0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838 0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946 0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526 2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341 6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893; #X coords 0 10 123 0 200 100 1; #X restore 302 48 graph; #X text 504 141 0; #X text 506 41 10; #X text 321 151 ------ 123 samples ------; #N canvas 0 0 450 300 graph2 0; #X array mtof 130 float 1; #A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499 12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017 21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478 36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705 61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989 103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814 174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183 293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164 493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991 830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51 1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32 2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07 4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88 7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3 11839.8 12543.9 13289.8 14080; #X coords 0 12000 130 0 200 100 1; #X restore 309 225 graph; #X text 319 333 ------ 130 samples ------; #X text 518 318 0; #X text 520 218 12000; #X restore 121 588 pd conversion-tables; #X obj 31 411 line~; #X obj 31 387 pack 0 100; #X floatatom 31 339 3 0 150 0 - #0-cf -; #X floatatom 47 461 3 0 999 0 - #0-q -; #X obj 16 512 vcf~; #X obj 31 436 tabread4~ mtof; #X text 81 461 <-- Q (selectivity); #X text 88 5 ANOTHER SWEEPING FILTER EXAMPLE; #X obj 15 267 clip~ 0 0.5; #X obj 15 291 *~ 2; #X obj 15 315 -~; #X text 119 268 trick to; #X text 120 285 make symmetric; #X text 118 302 triangle wave; #X obj 22 147 f; #X obj 55 145 + 1; #X obj 22 217 mtof; #X obj 55 169 mod 8; #N canvas 0 0 450 300 graph1 0; #X array $0-array1 8 float 2; #X coords 0 96 8 36 200 100 1; #X restore 340 144 graph; #X text 73 336 <-- center frequency; #X obj 22 123 metro 85; #X text 107 147 sequencer for; #X text 122 164 8 note loop; #X obj 16 576 output~; #X obj 22 104 tgl 15 0 empty $1-metro empty 0 -6 0 8 -262144 -1 -1 1 1; #N canvas 876 177 375 255 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X msg 22 91 ; $1-cf 61 ; $1-q 10 ; $1-metro 1 ; $1-array1 0 45 48 50 48 55 53 55 57; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 121 611 pd startup; #X text 96 364 at least 61; #X obj 22 241 phasor~; #X text 294 616 updated for Pd version 0.39; #X obj 22 193 tabread $0-array1; #X obj 16 540 vcf~; #X obj 31 362 max 61; #X text 82 409 smooth & convert to Hz.; #X obj 47 482 max 3; #X text 105 483 at least 3; #X text 11 28 Here's an approximate reconstruction of an old riff by Pink Floyd. Because we're filtering a waveform with odd partials , it's easier to pick out the partials in the filtered sound than if we had had both even and odd ones.; #X text 78 527 rejection of the stop bands without having; #X text 79 509 Put two vcf objects in series for better; #X text 77 545 to make the passband excessively narrow.; #X connect 1 0 6 0; #X connect 2 0 1 0; #X connect 3 0 32 0; #X connect 4 0 34 0; #X connect 5 0 31 0; #X connect 6 0 5 1; #X connect 6 0 31 1; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 11 0 5 0; #X connect 15 0 16 0; #X connect 15 0 30 0; #X connect 16 0 18 0; #X connect 17 0 28 0; #X connect 18 0 15 1; #X connect 21 0 15 0; #X connect 25 0 21 0; #X connect 28 0 9 0; #X connect 28 0 11 1; #X connect 30 0 17 0; #X connect 31 0 24 0; #X connect 31 0 24 1; #X connect 32 0 2 0; #X connect 34 0 5 2; #X connect 34 0 31 2;
--- NEW FILE: J02.trapezoids.pd --- #N canvas 262 74 690 585 12; #X obj 137 133 wrap~; #X obj 137 155 -~ 0.5; #N canvas 0 0 450 300 graph1 0; #X array $0-sum 882 float 0; #X coords 0 1.02 881 -1.02 200 130 1; #X restore 421 155 graph; #X text 420 293 ---- 0.02 seconds ----; #X text 427 550 updated for Pd version 0.39; #X obj 53 335 output~; #X obj 147 369 tabwrite~ $0-sum; #X obj 137 111 -~; #X obj 159 70 / 100; #X floatatom 159 49 4 -100 100 0 - - -; #X obj 158 220 / 100; #X floatatom 158 199 4 -100 100 0 - - -; #X obj 136 242 *~; #X obj 209 134 wrap~; #X obj 209 156 -~ 0.5; #X obj 209 112 -~; #X obj 231 71 / 100; #X floatatom 231 50 4 -100 100 0 - - -; #X obj 230 221 / 100; #X floatatom 230 200 4 -100 100 0 - - -; #X obj 208 243 *~; #X obj 280 135 wrap~; #X obj 280 157 -~ 0.5; #X obj 280 113 -~; #X obj 302 72 / 100; #X floatatom 302 51 4 -100 100 0 - - -; #X obj 301 222 / 100; #X floatatom 301 201 4 -100 100 0 - - -; #X obj 279 244 *~; #X text 138 30 -- PHASES (percent) --; #X text 164 180 AMPLITUDES (percent); #X obj 111 268 +~; #X obj 112 294 +~; #X text 31 3 Making trapezoidal waves from sawtooth waves; #X obj 158 321 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; #X obj 25 77 phasor~ 88.2; #X obj 158 343 metro 193; #X text 4 476 If the amplitudes sum to zero (with negative ones to balance positive ones) , the slope of each linear segment becomes zero. Otherrwise , the segments have just enough slope to make up for the three jumps ane get to the same starting value after each cycle.. ; #X text 4 408 Here we combine three sawtooth waves with controllable relative phases and amplitudes (in percent , between -100 and 100.) Each sawtooth wave gives rise to one jump (upward or downward) per cycle.; #X connect 0 0 1 0; #X connect 1 0 12 0; #X connect 7 0 0 0; #X connect 8 0 7 1; #X connect 9 0 8 0; #X connect 10 0 12 1; #X connect 11 0 10 0; #X connect 12 0 31 0; #X connect 13 0 14 0; #X connect 14 0 20 0; #X connect 15 0 13 0; #X connect 16 0 15 1; #X connect 17 0 16 0; #X connect 18 0 20 1; #X connect 19 0 18 0; #X connect 20 0 31 1; #X connect 21 0 22 0; #X connect 22 0 28 0; #X connect 23 0 21 0; #X connect 24 0 23 1; #X connect 25 0 24 0; #X connect 26 0 28 1; #X connect 27 0 26 0; #X connect 28 0 32 1; #X connect 31 0 32 0; #X connect 32 0 6 0; #X connect 32 0 5 0; #X connect 32 0 5 1; #X connect 34 0 36 0; #X connect 35 0 7 0; #X connect 35 0 15 0; #X connect 35 0 23 0; #X connect 36 0 6 0;
--- NEW FILE: H08.heterodyning.pd --- #N canvas 280 49 607 705 12; #X text 336 665 updated for Pd version 0.39; #X text 109 12 MORE ON MEASURING SPECTRA: HETERODYNING; #X obj 46 289 phasor~ 100; #X obj 99 343 phasor~; #X floatatom 99 320 5 0 999 0 - #0-freq -; #X obj 99 395 cos~; #X obj 148 395 cos~; #X obj 148 370 +~ 0.25; #X obj 47 547 snapshot~; #N canvas 536 459 382 265 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X obj 223 132 metro 250; #X obj 223 107 r $0-metro; #X obj 223 156 s $0-tick; #X msg 22 91 ; $1-freq 100 ; $1-lop 2 ; $1-metro 1 ; pd dsp 1; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 8 0; #X connect 5 0 7 0; #X connect 6 0 5 0; #X restore 382 573 pd startup; #X obj 47 446 *~; #X obj 91 446 *~; #X obj 48 471 lop~; #X obj 92 471 lop~; #X floatatom 153 435 3 0 100 0 - #0-lop -; #X text 186 435 <-- responsiveness; #X obj 136 547 snapshot~; #X floatatom 47 575 5 0 0 0 - - -; #X floatatom 136 575 5 0 0 0 - - -; #X obj 161 496 r $0-tick; #X obj 161 517 t b b; #X obj 47 643 expr sqrt($f1*$f1+$f2*$f2); #X floatatom 47 669 5 0 0 0 - - -; #X text 56 248 signal to; #X text 58 268 analyze; #X text 51 44 Another method for picking out the strengths of partials in a sound is heterodyning. We guess the frequency of a partial (as in the previous patch) but this time we multiply by a complex exponential to frequency-shift the partial down to zero (DC).; #X text 47 126 Then a low-pass filter (applied separately on the real and imaginary parts) removes all but the DC component thus obtained. The result is two audio signals (which we take snapshots of) holding the real and imaginary parts of the complex amplitude of the partial we want. Compared to the previous method , this had the advantage of reporting the phase of the partial as well as its frequency.; #X text 240 358 modulate; #X text 237 394 to DC; #X text 154 321 <-- test frequency; #X text 236 376 test frequency; #X text 132 471 low-pass filter; #X text 55 596 real; #X text 59 611 part; #X text 207 589 part; #X text 198 574 imaginary; #X text 105 670 magnitude; #X connect 2 0 10 0; #X connect 2 0 11 0; #X connect 3 0 5 0; #X connect 3 0 7 0; #X connect 4 0 3 0; #X connect 5 0 10 1; #X connect 6 0 11 1; #X connect 7 0 6 0; #X connect 8 0 17 0; #X connect 10 0 12 0; #X connect 11 0 13 0; #X connect 12 0 8 0; #X connect 13 0 16 0; #X connect 14 0 13 1; #X connect 14 0 12 1; #X connect 16 0 18 0; #X connect 17 0 21 0; #X connect 18 0 21 1; #X connect 19 0 20 0; #X connect 20 0 8 0; #X connect 20 1 16 0; #X connect 21 0 22 0;
--- NEW FILE: I07.phase.vocoder.pd --- #N canvas 425 33 744 599 12; #X floatatom 494 315 5 0 0 0 - transpo-set -; #X floatatom 167 383 3 0 0 0 - speed-set -; #X floatatom 55 385 7 0 0 0 - location-set -; #N canvas 90 42 821 693 fft-analysis 0; #X obj 51 477 *~; #X obj 18 477 *~; #X obj 18 499 -~; #X obj 167 475 *~; #X obj 136 475 *~; #X obj 136 497 +~; #X obj 109 193 *~; #X obj 78 193 *~; #X obj 50 193 *~; #X obj 19 193 *~; #X obj 19 218 +~; #X obj 127 379 *~; #X obj 20 622 *~; #X obj 238 430 rfft~; #X obj 108 161 rfft~; #X obj 19 564 rifft~; #X obj 21 646 outlet~; #X obj 97 379 *~; #X obj 97 401 +~; #X obj 124 218 -~; #X obj 18 431 *~; #X obj 51 432 *~; #X obj 127 622 r window-size; #X obj 426 595 r window-size; #X obj 426 644 block~; #X obj 19 349 +~ 1e-15; #X obj 19 598 *~; #X obj 52 598 tabreceive~ $0-hann; #X obj 127 643 expr 2/(3*$f1); #X obj 591 563 loadbang; #X msg 591 589 ; pd dsp 1 ; window-size 2048 ; transpo 0 ; rewind bang; #X msg 426 619 set $1 4; #X obj 97 425 q8_rsqrt~; #N canvas 139 105 1006 799 read-windows 0; #X obj 18 693 *~; #X obj 340 448 r window-size; #X obj 156 300 f; #X obj 102 91 r window-size; #X obj 102 139 /; #X obj 195 695 *~; #X obj 156 255 bang~; #X obj 17 551 line~; #X obj 102 164 * 1000; #X obj 288 224 r speed; #X obj 178 276 r location; #X obj 198 302 +; #X obj 288 272 *; #X obj 183 470 +; #X obj 143 446 t f f; #X msg 17 523 $1 , $2 $3; #X obj 17 496 pack 0 0 0; #X obj 178 371 / 1000; #X obj 156 394 *; #X text 188 394 reading location (samples); #X obj 51 597 / 4; #X obj 288 245 * 0.01; #X floatatom 340 498 7 0 0 0 - - -; #X obj 340 474 *; #X obj 499 365 r transpo; #X obj 499 387 * 0.01; #X obj 501 408 + 69; #X obj 502 429 mtof; #X obj 502 451 / 440; #X obj 375 474 t b f; #X obj 19 719 outlet~; #X obj 195 720 outlet~; #X obj 218 664 tabreceive~ $0-hann; #X obj 803 386 r location; #X msg 803 409 0; #X obj 803 432 s speed; #X obj 768 508 r speed; #X msg 768 532 set $1; #X obj 768 557 s speed-set; #X text 411 498 stretched window size (samples); #X obj 877 507 r transpo; #X msg 877 533 set $1; #X obj 877 558 s transpo-set; #X obj 808 94 r location; #X msg 826 278 set $1; #X obj 808 140 t b f; #X obj 826 257 f; #X obj 754 171 int; #X obj 754 203 sel 0; #X msg 813 174 1; #X msg 813 197 0; #X obj 754 228 del 300; #X obj 826 302 s location-set; #X obj 17 637 tabread4~ $0-sample; #X obj 194 637 tabread4~ $0-sample; #X obj 178 347 r $0-insamprate; #X obj 528 586 r rewind; #X msg 528 744 ; location $1; #X floatatom 111 187 5 0 0 0 - - -; #X obj 102 115 t f b; #X obj 142 139 samplerate~; #X obj 102 208 / 4; #X obj 233 306 s see-loc; #X obj 817 116 r see-loc; #X obj 193 420 / 2; #X obj 156 420 -; #X text 229 417 back up 1/2 window; #X obj 16 597 -~; #X text 43 6 Read two windows out of the recorded sample , one 1/4 ahead of the other. The mid point of the front window is specified by "location". If "speed" is nonzero , "location" automatically precesses. ; #X obj 528 720 * -0.5; #X text 91 587 "back" window 1/4 cycle behind "front" one; #X text 137 205 computation period (msec) for overlap of 4; #X text 164 186 msec in a window; #X obj 528 666 /; #X obj 528 691 * 1000; #X obj 528 642 t f b; #X obj 568 666 samplerate~; #X obj 528 619 f; #X msg 845 711 ; rewind bang ; speed $1; #X obj 845 684 r auto; #X obj 730 685 r no-detune; #X msg 730 707 ; detune 0; #X text 326 275 loop to precess the location according; #X text 325 291 to the "speed" parameter.; #X text 611 31 if location changes , update number box; #X text 610 50 in main window via "location-set" , but; #X text 613 69 taking care to limit frequency of updates.; #X text 756 462 reflect control changes; #X text 756 479 in main window.; #X text 754 344 setting location by hand; #X text 752 362 sets speed to zero.; #X text 760 653 misc controls; #X text 496 527 "rewind" control takes us; #X text 499 545 to a location depending on; #X text 499 564 stretched window size.; #X connect 0 0 30 0; #X connect 1 0 23 0; #X connect 2 0 11 0; #X connect 2 0 18 0; #X connect 3 0 59 0; #X connect 4 0 8 0; #X connect 5 0 31 0; #X connect 6 0 2 0; #X connect 7 0 67 0; #X connect 7 0 54 0; #X connect 8 0 58 0; #X connect 8 0 61 0; #X connect 9 0 21 0; #X connect 10 0 2 1; #X connect 11 0 2 1; #X connect 11 0 62 0; #X connect 12 0 11 1; #X connect 13 0 16 1; #X connect 14 0 16 0; #X connect 14 1 13 0; #X connect 15 0 7 0; #X connect 16 0 15 0; #X connect 17 0 18 1; #X connect 18 0 65 0; #X connect 20 0 67 1; #X connect 21 0 12 0; #X connect 22 0 20 0; #X connect 22 0 13 1; #X connect 22 0 64 0; #X connect 22 0 77 1; #X connect 23 0 22 0; #X connect 24 0 25 0; #X connect 25 0 26 0; #X connect 26 0 27 0; #X connect 27 0 28 0; #X connect 28 0 29 0; #X connect 29 0 23 0; #X connect 29 1 23 1; #X connect 32 0 5 1; #X connect 32 0 0 1; #X connect 33 0 34 0; #X connect 34 0 35 0; #X connect 36 0 37 0; #X connect 37 0 38 0; #X connect 40 0 41 0; #X connect 41 0 42 0; #X connect 43 0 45 0; #X connect 44 0 52 0; #X connect 45 0 47 0; #X connect 45 1 46 1; #X connect 46 0 44 0; #X connect 47 0 48 0; #X connect 48 0 49 0; #X connect 48 0 51 0; #X connect 49 0 47 1; #X connect 50 0 47 1; #X connect 51 0 50 0; #X connect 51 0 46 0; #X connect 53 0 0 0; #X connect 54 0 5 0; #X connect 55 0 17 0; #X connect 56 0 77 0; #X connect 59 0 4 0; #X connect 59 1 60 0; #X connect 60 0 4 1; #X connect 61 0 16 2; #X connect 61 0 12 1; #X connect 63 0 45 0; #X connect 64 0 65 1; #X connect 65 0 14 0; #X connect 67 0 53 0; #X connect 69 0 57 0; #X connect 73 0 74 0; #X connect 74 0 69 0; #X connect 75 0 73 0; #X connect 75 1 76 0; #X connect 76 0 73 1; #X connect 77 0 75 0; #X connect 79 0 78 0; #X connect 80 0 81 0; #X restore 109 133 pd read-windows; #X obj 137 543 tabsend~ prev-imag; #X obj 136 567 tabsend~ prev-real; #X obj 20 8 tabreceive~ prev-real; #X obj 73 29 tabreceive~ prev-imag; #X text 272 5 recall previous output amplitude. Its phase will be added to the phase difference we measure from two windows in the the recorded sound.; #X obj 121 69 *~; #X obj 89 69 *~; #X obj 89 91 +~; #X obj 159 94 q8_rsqrt~; #X obj 159 71 +~ 1e-20; #X obj 73 119 *~; #X obj 19 118 *~; #X obj 181 290 r lock; #X obj 29 245 lrshift~ 1; #X obj 24 269 lrshift~ -1; #X obj 141 245 lrshift~ 1; #X obj 133 269 lrshift~ -1; #X obj 35 300 *~; #X obj 159 312 *~; #X obj 19 325 +~; #X obj 125 331 +~; #X text 247 66 divide by the magnitude to make a unit-magnitude complex amplitude (phase only). The 1e-20 is to prevent overflows. q8_rsqrt~ is reciprocal square root.; #X text 247 165 Take FT of the window in back. Multiply its conjugate by the normalized previous output. The result has the magnitude of the input sound and phase (previous output phase) minus (back window phase).; #X text 249 370 Normalize again , this time taking care to salt each channel with 1e-15 so that we get a unit complex number even if everything was zero heretofore.; #X text 288 427 Now take the FT of the forward window and multiply it by the unit complex number from above. The magnitude will be that of the forward window and the phase will be the previous output phase plus the phase difference between the two analysis windows -- except that if "lock" is on , they will be modified to agree progressively better with the inter-channel phase relationships of the input.; #X text 249 242 If "lock" is on , encourage neighboring channels to stay in phase by adding the two neighboring complex amplitudes. The result will tend toward the channel with the strongest amplitude. If the phase relationships between channels in the output and those in the input are in parallel , then neighboring channels of the quotient will all have the same phase and this will not change any phases. (lrshift shifts the signal to the left or right depending on its argument.) ; #X text 387 560 'set' message to block; #X text 390 577 allows variable size; #X text 259 126 Read two windows , one 1/4 length behind the other , of the input sound , with Hann window function (see inside).; #X connect 0 0 2 1; #X connect 1 0 2 0; #X connect 2 0 35 0; #X connect 2 0 15 0; #X connect 3 0 5 1; #X connect 4 0 5 0; #X connect 5 0 34 0; #X connect 5 0 15 1; #X connect 6 0 19 1; #X connect 7 0 19 0; #X connect 8 0 10 1; #X connect 9 0 10 0; #X connect 10 0 48 0; #X connect 10 0 47 0; #X connect 10 0 53 0; #X connect 11 0 18 1; #X connect 12 0 16 0; #X connect 13 0 1 1; #X connect 13 0 3 1; #X connect 13 1 0 1; #X connect 13 1 4 1; #X connect 14 0 9 1; #X connect 14 0 7 1; #X connect 14 1 6 1; #X connect 14 1 8 1; #X connect 15 0 26 0; #X connect 17 0 18 0; #X connect 18 0 32 0; #X connect 19 0 49 0; #X connect 19 0 50 0; #X connect 19 0 54 0; #X connect 20 0 1 0; #X connect 20 0 4 0; #X connect 21 0 0 0; #X connect 21 0 3 0; #X connect 22 0 28 0; #X connect 23 0 31 0; #X connect 25 0 17 1; #X connect 25 0 17 0; #X connect 25 0 20 0; #X connect 26 0 12 0; #X connect 27 0 26 1; #X connect 28 0 12 1; #X connect 29 0 30 0; #X connect 31 0 24 0; #X connect 32 0 20 1; #X connect 32 0 21 1; #X connect 33 0 14 0; #X connect 33 1 13 0; #X connect 36 0 40 1; #X connect 36 0 40 0; #X connect 36 0 45 0; #X connect 37 0 39 1; #X connect 37 0 39 0; #X connect 37 0 44 0; #X connect 39 0 41 1; #X connect 40 0 41 0; #X connect 41 0 43 0; #X connect 42 0 44 1; #X connect 42 0 45 1; #X connect 43 0 42 0; #X connect 44 0 8 0; #X connect 44 0 7 0; #X connect 45 0 9 0; #X connect 45 0 6 0; #X connect 46 0 51 1; #X connect 46 0 52 1; #X connect 47 0 51 0; #X connect 48 0 51 0; #X connect 49 0 52 0; #X connect 50 0 52 0; #X connect 51 0 53 1; #X connect 52 0 54 1; #X connect 53 0 25 0; #X connect 54 0 11 0; #X connect 54 0 11 1; #X connect 54 0 21 0; #X restore 55 480 pd fft-analysis; #N canvas 260 23 647 768 phase-tables 0; #N canvas 0 0 450 300 graph2 0; #X array prev-imag 4096 float 0; #X coords 0 1000 4096 -1000 400 300 1; #X restore 169 326 graph; #N canvas 0 0 450 300 graph3 0; #X array prev-real 4096 float 0; #X coords 0 500 4096 -500 400 300 1; #X restore 170 17 graph; #X restore 440 504 pd phase-tables; #X obj 494 338 s transpo; #X text 164 364 hundredths; #X text 493 294 in cents; #X text 389 359 normal; #X obj 56 517 output~; #N canvas 0 110 565 454 hann-window 0; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 1024 float 0; #X coords 0 1 1023 0 300 100 1; #X restore 82 311 graph; #X obj 378 165 osc~; #X obj 378 190 *~ -0.5; #X obj 378 214 +~ 0.5; #X obj 331 247 tabwrite~ $0-hann; #X obj 37 88 r window-size; #X obj 38 173 /; #X obj 127 142 samplerate~; #X obj 38 251 s window-sec; #X obj 177 204 swap; #X obj 177 228 /; #X obj 177 252 s window-hz; #X obj 49 201 * 1000; #X obj 49 228 s window-msec; #X obj 38 115 t f b f; #X msg 173 92 resize $1; #X obj 173 116 s $0-hann; #X obj 330 105 r window-hz; #X msg 382 130 0; #X obj 330 131 t f b; #X text 15 8 calculate Hann window table (variable window size) and constants window-hz (fundamental frequency of analysis) , window-sec and window-msec (analysis window size in seconds and msec).; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 5 0 14 0; #X connect 6 0 8 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 7 0 9 1; #X connect 9 0 10 0; #X connect 9 1 10 1; #X connect 10 0 11 0; #X connect 12 0 13 0; #X connect 14 0 6 0; #X connect 14 0 9 0; #X connect 14 1 7 0; #X connect 14 2 15 0; #X connect 15 0 16 0; #X connect 17 0 19 0; #X connect 18 0 1 1; #X connect 19 0 1 0; #X connect 19 1 4 0; #X connect 19 1 18 0; #X restore 440 528 pd hann-window; #N canvas 388 86 694 447 insample 0; #N canvas 0 0 450 300 graph1 0; #X array $0-sample 160161 float 0; #X coords 0 1 160160 -1 400 150 1; #X restore 281 135 graph; #X obj 28 133 r read-sample; #X obj 28 184 unpack s f; #X obj 28 294 soundfiler; #X text 365 360 read a sample; #X obj 285 359 loadbang; #X obj 28 210 t s b; #X obj 84 209 symbol $0-sample; #X obj 28 245 pack s s; #X msg 28 270 read -resize $1 $2; #X obj 83 156 44100; #X obj 28 157 t a b; #X obj 38 318 s $0-samplength; #X obj 125 184 s $0-insamprate; #X obj 28 357 /; #X obj 28 381 * 1000; #X obj 28 404 s $0-samp-msec; #X obj 66 357 r $0-insamprate; #X obj 29 70 hip~ 5; #X obj 29 46 adc~ 1; #X obj 29 9 inlet; #X obj 91 46 samplerate~; #X obj 29 93 tabwrite~ $0-sample; #X obj 91 70 s $0-insamprate; #X msg 285 383 ; read-sample ../sound/voice.wav; #X obj 276 20 inlet; #X obj 276 42 openpanel; #X obj 276 67 s read-sample; #X connect 1 0 11 0; #X connect 2 0 6 0; #X connect 2 1 13 0; #X connect 3 0 12 0; #X connect 3 0 14 0; #X connect 5 0 24 0; #X connect 6 0 8 0; #X connect 6 1 7 0; #X connect 7 0 8 1; #X connect 8 0 9 0; #X connect 9 0 3 0; #X connect 10 0 13 0; #X connect 11 0 2 0; #X connect 11 1 10 0; #X connect 14 0 15 0; #X connect 15 0 16 0; #X connect 17 0 14 1; #X connect 18 0 22 0; #X connect 19 0 18 0; #X connect 20 0 21 0; #X connect 20 0 19 0; #X connect 21 0 23 0; #X connect 25 0 26 0; #X connect 26 0 27 0; #X restore 441 480 pd insample; #X floatatom 552 480 5 0 0 0 - #0-samp-msec -; #X msg 229 486 ../sound/bell.aiff; #X msg 229 511 ../sound/voice.wav; #X msg 229 536 ../sound/voice2.wav; #X obj 229 562 s read-sample; #X obj 441 439 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 460 438 <- record; #X obj 493 387 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X obj 55 407 s location; #X obj 167 407 s speed; #X obj 262 386 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 262 408 s rewind; #X msg 345 336 200; #X msg 345 358 100; #X msg 345 380 20; #X text 386 335 contract; #X text 390 380 expand; #X obj 493 407 s lock; #X text 494 277 detune; #X text 55 330 location; #X text 52 346 (stops; #X text 57 361 motion); #X text 165 348 motion in; #X text 232 464 read input sound; #X text 103 7 PHASE VOCODER FOR TIME STETCHING AND CONTRACTION; #X text 604 479 length , msec; #X floatatom 607 419 5 0 0 0 - window-size -; #X msg 607 307 512; #X msg 607 329 1024; #X msg 607 351 2048; #X msg 607 373 4096; #X obj 607 395 s window-size; #X text 607 274 window size ,; #X text 607 289 samples; #X text 648 306 <- set; #X text 100 306 ------- location controls -------; #X text 660 419 (check); #X obj 345 407 s auto; #X text 23 35 This patch takes a sound , analyzes windows in it both for channel magnitude and for phase precession in each channel (compared to another operlapping window). The real-time output recreates the same magnitudes and phase precession , althought the phases themselves are in general different. You can control either the location or its motion (setting location stops motion , while setting a non-zero motion causes the location to change automatically). "Rewind" goes back to the beginning. You can use different window sizes (use the message boxes - the number box is for readout). The "lock" feature forces phase coherency between neighboring channels , which makes a more present sound but can add artifacts to the sound. Look in "pd fft-analysis" to see the workings.; #X text 483 568 updated for Pd version 0.39; #X obj 551 316 bng 15 250 50 0 no-detune empty empty 0 -6 0 8 -262144 -1 -1; #X obj 535 460 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 466 458 file ->; #X connect 0 0 5 0; #X connect 1 0 21 0; #X connect 2 0 20 0; #X connect 3 0 9 0; #X connect 3 0 9 1; #X connect 13 0 16 0; #X connect 14 0 16 0; #X connect 15 0 16 0; #X connect 17 0 11 0; #X connect 19 0 29 0; #X connect 22 0 23 0; #X connect 24 0 49 0; #X connect 25 0 49 0; #X connect 26 0 49 0; #X connect 39 0 43 0; #X connect 40 0 43 0; #X connect 41 0 43 0; #X connect 42 0 43 0; #X connect 53 0 11 1;
--- NEW FILE: J03.pulse.width.mod.pd --- #N canvas 46 315 784 514 12; #X floatatom 95 64 0 0 0 0 - - -; #N canvas 0 0 450 300 graph1 0; #X array $0-difference 882 float 0; #X coords 0 1.02 882 -1.02 200 130 1; #X restore 565 325 graph; #X text 81 39 frequency; #N canvas 0 0 450 300 graph1 0; #X array $0-phasor1 882 float 0; #X coords 0 1.02 882 -1.02 200 130 1; #X restore 565 24 graph; #X text 57 9 CLASSICAL PULSE WIDTH MODULATION; #X obj 111 156 phasor~ 0; #X obj 111 132 + 0.2; #X obj 95 206 -~; #N canvas 0 0 450 300 graph1 0; #X array $0-phasor2 882 float 0; #X coords 0 1.02 882 -1.02 200 130 1; #X restore 565 176 graph; #X text 24 314 This patch demonstrates pulse width modulation , which is accomplished simply by subtracting two sawtooth waves at a varying phase difference. Here their frequencies are set to differ by 1/5 Hz. so that the relative phase wanders continuously.; #X text 570 457 ---- 0.02 seconds ----; #X text 524 487 updated for Pd version 0.39; #X obj 96 247 output~; #X obj 200 124 tabwrite~ $0-phasor1; #X obj 200 182 tabwrite~ $0-phasor2; #X obj 200 236 tabwrite~ $0-difference; #X obj 95 97 phasor~; #X obj 200 82 metro 193; #X obj 200 62 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X text 219 60 <-- start/stop graphing; #X connect 0 0 6 0; #X connect 0 0 16 0; #X connect 5 0 7 1; #X connect 5 0 14 0; #X connect 6 0 5 0; #X connect 7 0 12 0; #X connect 7 0 12 1; #X connect 7 0 15 0; #X connect 16 0 7 0; #X connect 16 0 13 0; #X connect 17 0 13 0; #X connect 17 0 14 0; #X connect 17 0 15 0; #X connect 18 0 17 0;
--- NEW FILE: H12.peaking.pd --- #N canvas 41 39 854 640 12; #N canvas 0 0 450 300 graph2 0; #X array $0-tab1 100 float 1; #A 0 0.960563 0.960996 0.962862 0.970269 0.977017 0.985214 1.00122 1.02249 1.05453 1.10332 1.18193 1.31034 1.5315 1.91468 2.37977 2.37001 1.92679 1.57244 1.36114 1.23298 1.15262 1.09943 1.06243 1.03636 1.0162 1.00108 0.990295 0.981066 0.973613 0.967183 0.962328 0.958092 0.95445 0.951329 0.948619 0.946121 0.943931 0.941728 0.940557 0.93934 0.938046 0.936816 0.935569 0.934901 0.933719 0.933252 0.932534 0.931875 0.93121 0.930347 0.929637 0.929717 0.929279 0.928865 0.928444 0.927868 0.92761 0.926893 0.927202 0.926932 0.926666 0.926305 0.925926 0.926007 0.925702 0.925624 0.92545 0.925285 0.924954 0.924532 0.924071 0.924718 0.924596 0.924454 0.924247 0.923846 0.924172 0.923627 0.924005 0.92393 0.923866 0.923769 0.923157 0.923666 0.923974 0.923561 0.923498 0.923437 0.922882 0.922781 0.92203 0.923331 0.923265 0.922948 0.922413 0.922799 0.925651 0.921397 0.931729 0.976084; #X coords 0 5 99 0 200 300 1; #X restore 616 193 graph; #X obj 41 404 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 49 448 3 0 0 0 - - -; #X text 671 499 frequency; #N canvas 876 177 375 255 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X msg 22 91 ; $1-pole 60 ; $1-zero 20; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 328 602 pd startup; #X floatatom 276 368 3 0 99 0 - #0-pole -; #X text 554 481 gain=0; #X obj 41 600 filter-graph2 $0-tab1; #X obj 41 425 filter-graph1 100 22050; #X text 791 495 22050; #X obj 276 391 / 100; #X floatatom 330 367 4 0 100 0 - #0-zero -; #X obj 330 390 / 100; #X text 594 182 5; #X text 611 492 0; #X text 599 423 1; #X text 596 596 updated for Pd version 0.39; #X text 183 10 PEAKING FILTER; #X floatatom 406 366 3 0 180 0 - #0-pole -; #X text 415 328 angle; #X text 399 344 (degrees); #X obj 460 435 sin; #X obj 405 436 cos; #X obj 405 387 * 3.14159; #X obj 405 411 / 180; #X obj 241 515 *; #X obj 405 460 t b f; #X obj 460 460 t b f; #X obj 209 543 cpole~; #X obj 226 574 czero~; #X text 266 332 pole and zero; #X text 284 347 radii (%); #X obj 277 516 *; #X obj 314 542 *; #X obj 349 542 *; #X text 21 34 To get a peaking filter , start with a shelving filter but rotate the pole and zero to the point on the unit circle you want to amplify or attenuate. The rpole~ and rzero~ filters are replaced with their complex-valued siblings , cpole~ and czero~. These filters take a (real , imaginary) pair to filter and another (real-imaginary) pair to specify the pole or zero. As for rpole~ and rzero~ , the coefficients may change at audio rate.; #X text 22 162 The outputs of cpole~ and czero~ are also in the form of a (real-imaginary) pair. Both outlets of cpole~ are connected to czero~ in this example , but then since we want a real-valued filter , we only take the real part of the (complex) output of czero~.; #X text 23 246 Here the pole and zero radii (p and q) control the center-frequency gain by the formula (1-q)/(1-p). The closer to 1 the radii , the narrower the band affected. The non-peak gain , (1+q)/(1+p) , is close to 1 as long as p and q are at least 50% or so.; #X connect 1 0 8 0; #X connect 5 0 10 0; #X connect 8 0 2 0; #X connect 8 0 7 0; #X connect 8 1 7 1; #X connect 8 1 28 0; #X connect 8 2 7 2; #X connect 10 0 25 0; #X connect 10 0 32 0; #X connect 11 0 12 0; #X connect 12 0 33 0; #X connect 12 0 34 0; #X connect 18 0 23 0; #X connect 21 0 27 0; #X connect 22 0 26 0; #X connect 23 0 24 0; #X connect 24 0 22 0; #X connect 24 0 21 0; #X connect 25 0 28 2; #X connect 26 0 25 0; #X connect 26 0 33 0; #X connect 26 1 25 1; #X connect 26 1 33 1; #X connect 27 0 32 0; #X connect 27 0 34 0; #X connect 27 1 34 1; #X connect 27 1 32 1; #X connect 28 0 29 0; #X connect 28 1 29 1; #X connect 29 0 7 3; #X connect 32 0 28 3; #X connect 33 0 29 2; #X connect 34 0 29 3;
--- NEW FILE: filter-graph2.pd --- #N canvas 72 200 758 579 10; #X obj 266 177 *~; #X obj 317 175 *~; #X obj 182 276 t b b; #X obj 368 382 atan2; #X obj 267 302 snapshot~; #X obj 341 301 snapshot~; #X obj 450 259 butterworth3~ 80 100000 0; #X obj 64 135 inlet; #X obj 368 410 expr $f1 + 6.283 * ($f1 < -0.01); #X obj 71 417 t b f b; #X obj 448 457 symbol $2; #X obj 519 457 symbol; #X obj 463 434 t b b; #X obj 447 504 t b; #X obj 474 505 t b; #X msg 447 525 0; #X msg 474 526 1; #X obj 447 481 sel symbol; #X floatatom 447 549 5 0 0 0 - - -; #X obj 195 493 f; #X obj 265 135 inlet~; #X obj 318 135 inlet~; #X obj 418 134 inlet~; #X obj 374 495 f; #X obj 368 442 spigot; #X obj 333 495 t f b; #X obj 154 493 t f b; #X obj 154 521 tabwrite $1; #X obj 333 520 tabwrite $2; #X obj 637 259 env~ 2048; #X obj 311 362 f; #X obj 267 324 t f f b; #X obj 311 382 dbtopow; #X obj 137 411 expr sqrt($f1*$f1 + $f2*$f2)/$f3; #X obj 63 245 sel 0; #X obj 87 270 - 1; #X obj 64 156 unpack; #X obj 117 157 expr 10000/$f1; #X text 257 102 test sinusoid:; #X text 272 116 cos; #X text 325 115 sin; #X text 397 97 output of filter; #X text 398 113 we're testing; #X text 31 103 index and time to next step; #X text 39 82 ----- from filter-graph1's 3 outlets: -------; #X text 117 193 low-pass filters; #X text 118 177 cutoff freq. for; #X obj 368 360 swap; #X obj 620 215 t b; #X text 583 184 clear filters; #X text 582 198 to start; #X text 578 452 cbeck if any table; #X text 577 467 is specified for phase; #X text 577 483 (don't compute it if; #X text 578 498 not.); #X text 31 3 filter-graph2: measures frequency and phase response of a filter , which should be driven by a "filter-graph1" object. We need the three outputs of filter-graph1 , plus the filter output. ; #X text 438 55 1: table name for frequency response; #X text 518 39 creation arguments:; #X text 438 71 2 (optional): table name for phase response; #X obj 266 260 butterworth3~ 80 100000 0; #X connect 0 0 59 0; #X connect 1 0 6 0; #X connect 2 0 4 0; #X connect 2 1 5 0; #X connect 3 0 8 0; #X connect 4 0 31 0; #X connect 5 0 33 1; #X connect 5 0 47 1; #X connect 6 0 5 0; #X connect 7 0 36 0; #X connect 8 0 24 0; #X connect 9 0 2 0; #X connect 9 1 19 1; #X connect 9 1 23 1; #X connect 9 2 12 0; #X connect 10 0 17 0; #X connect 11 0 17 1; #X connect 12 0 10 0; #X connect 12 1 11 0; #X connect 13 0 15 0; #X connect 14 0 16 0; #X connect 15 0 18 0; #X connect 16 0 18 0; #X connect 17 0 13 0; #X connect 17 1 14 0; #X connect 18 0 24 1; #X connect 19 0 27 1; #X connect 20 0 0 0; #X connect 20 0 29 0; #X connect 21 0 1 0; #X connect 22 0 1 1; #X connect 22 0 0 1; #X connect 23 0 28 1; #X connect 24 0 25 0; #X connect 25 0 28 0; #X connect 25 1 23 0; #X connect 26 0 27 0; #X connect 26 1 19 0; #X connect 29 0 30 1; #X connect 30 0 32 0; #X connect 31 0 33 0; #X connect 31 1 47 0; #X connect 31 2 30 0; #X connect 32 0 33 2; #X connect 33 0 26 0; #X connect 34 1 35 0; #X connect 34 1 48 0; #X connect 35 0 9 0; #X connect 36 0 34 0; #X connect 36 1 37 0; #X connect 37 0 6 1; #X connect 37 0 59 1; #X connect 47 0 3 0; #X connect 47 1 3 1; #X connect 48 0 6 4; #X connect 48 0 59 4; #X connect 59 0 4 0;
--- NEW FILE: H14.all.pass.pd --- #N canvas 25 22 868 421 12; #X obj 25 338 filter-graph2 tab1 tab2; #N canvas 0 0 450 300 graph2 0; #X array tab1 100 float 1; #A 0 0.999994 1.0015 1.00454 0.999907 0.99994 0.999773 1.00002 1.0004 0.999993 0.998703 1 0.999993 1 0.999699 0.999312 0.99924 0.999999 1 0.999937 0.999782 0.999733 0.999322 0.9998 1 0.999998 0.999945 0.999998 0.999779 0.999998 1 0.999991 0.999998 0.999999 0.99949 1 0.999165 1 0.999991 0.999833 0.999694 1.00014 0.999247 1.00001 0.999976 1.00001 0.99974 0.999947 0.998428 1.00052 1.00383 1.00011 0.991395 1.0006 1.00077 0.999952 0.999955 1.00003 0.999937 0.999955 0.999616 0.999266 0.99916 1 0.999989 0.999831 0.999696 1 0.999239 0.999998 0.999998 0.999993 0.999998 0.999998 0.999426 0.999998 0.999999 0.999998 0.999916 0.999714 0.99951 0.999825 0.999998 0.999999 0.999962 0.999837 0.999605 1 0.999164 0.999996 0.99999 1 0.99999 0.999991 0.998888 1.00002 0.999955 0.999942 0.999432 1.00007 1.00956; #X coords 0 2 99 0 200 140 1; #X restore 634 -1 graph; #N canvas 0 0 450 300 graph2 0; #X array tab2 100 float 3; #A 0 8.595e-06 0.0615936 0.127096 0.18809 0.251487 0.314087 0.376949 0.439804 0.502669 0.565481 0.628309 0.691149 0.753982 0.816816 0.879645 0.942477 1.00531 1.06814 1.13097 1.1938 1.25663 1.31947 1.3823 1.44513 1.50796 1.5708 1.63363 1.69646 1.75929 1.82212 1.88496 1.94779 2.01062 2.07345 2.13628 2.19912 2.26195 2.32478 2.38761 2.45045 2.51327 2.5761 2.63893 2.70178 2.76457 2.82751 2.89011 2.9535 3.01727 3.08969 3.14147 3.19331 3.26573 3.3295 3.39289 3.45549 3.51843 3.58122 3.64407 3.7069 3.76973 3.83255 3.89539 3.95822 4.02105 4.08388 4.14672 4.20955 4.27238 4.33521 4.39804 4.46088 4.52371 4.58654 4.64937 4.7122 4.77504 4.83787 4.9007 4.96353 5.02637 5.0892 5.15203 5.21486 5.27769 5.34052 5.40335 5.46619 5.52902 5.59185 5.65469 5.71752 5.78033 5.8432 5.90605 5.96891 6.03151 6.09491 6.1559 6.21446; #X coords 0 6.283 99 0 200 140 1; #X restore 639 200 graph; #X text 621 56 1; #X text 633 342 0; #X text 615 265 pi; #X text 608 195 2pi; #X obj 25 203 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 33 249 5 0 0 0 - - -; #X text 621 -8 2; #X text 610 382 updated for Pd version 0.39; #X text 691 145 frequency; #X text 631 141 0; #X text 814 144 44100; #N canvas 876 177 375 255 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X msg 22 91 ; $1-pole 80; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 398 370 pd startup; #X text 575 127 gain=0; #X text 574 327 phase=0; #X obj 25 226 filter-graph1 100 44100; #X text 44 202 <-- compute; #X text 34 266 index; #X text 104 -6 ALL-PASS FILTERS; #X floatatom 346 264 3 -99 99 0 - #0-pole -; #X obj 239 306 rpole~; #X obj 346 287 / 100; #X obj 239 281 rzero_rev~; #X text 341 240 pole (%); #X text 14 20 The all-pass filter has a phase response that depends on its coefficient , and a flat frequency response. The coefficient (p) gives the location of the pole. There is a zero at 1/p , unless p=0. If p=0 the filter is effectively a one-sample delay. Negative values of $p$ are allowed , as long as p is between -1 and 1; #X connect 7 0 17 0; #X connect 17 0 0 0; #X connect 17 0 8 0; #X connect 17 1 0 1; #X connect 17 1 24 0; #X connect 17 2 0 2; #X connect 21 0 23 0; #X connect 22 0 0 3; #X connect 23 0 24 1; #X connect 23 0 22 1; #X connect 24 0 22 0;
--- NEW FILE: H15.phaser.pd --- #N canvas 25 22 703 596 12; #X text 448 562 updated for Pd version 0.39; #X text 167 -1 PHASER; #N canvas 876 177 375 255 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X msg 22 91 ; $1-pole 80; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 323 561 pd startup; #N canvas 0 0 660 424 chord 0; #X obj 87 97 -~ 0.5; #X obj 87 146 clip~ -0.5 0.5; #X obj 87 169 cos~; #X obj 91 252 hip~ 5; #X obj 91 315 outlet~; #X obj 87 122 *~ 3; #X obj 87 74 phasor~ 220; #X obj 221 97 -~ 0.5; #X obj 221 146 clip~ -0.5 0.5; #X obj 221 169 cos~; #X obj 221 122 *~ 3; #X obj 356 100 -~ 0.5; #X obj 356 149 clip~ -0.5 0.5; #X obj 356 172 cos~; #X obj 356 125 *~ 3; #X obj 491 100 -~ 0.5; #X obj 491 149 clip~ -0.5 0.5; #X obj 491 172 cos~; #X obj 491 125 *~ 3; #X obj 221 74 phasor~ 251; #X obj 356 77 phasor~ 281; #X obj 491 77 phasor~ 311; #X text 147 32 test sound for phaser; #X obj 91 285 *~ 0.2; #X connect 0 0 5 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 23 0; #X connect 5 0 1 0; #X connect 6 0 0 0; #X connect 7 0 10 0; #X connect 8 0 9 0; #X connect 9 0 3 0; #X connect 10 0 8 0; #X connect 11 0 14 0; #X connect 12 0 13 0; #X connect 13 0 3 0; #X connect 14 0 12 0; #X connect 15 0 18 0; #X connect 16 0 17 0; #X connect 17 0 3 0; #X connect 18 0 16 0; #X connect 19 0 7 0; #X connect 20 0 11 0; #X connect 21 0 15 0; #X connect 23 0 4 0; #X restore 73 271 pd chord; #X obj 72 533 output~; #X obj 95 325 rpole~; #X obj 95 300 rzero_rev~; #X obj 95 374 rpole~; #X obj 95 349 rzero_rev~; #X obj 95 422 rpole~; #X obj 95 397 rzero_rev~; #X obj 95 471 rpole~; #X obj 95 446 rzero_rev~; #X obj 72 501 +~; #X text 23 17 The phaser ranks , along with fuzz and wah-wah , as one of the great guitar pedals. A phaser simply adds an all-passed copy of the signal to the original , making phase reinforcement and cancellation at frequencies that depend on the all-pass coefficients. In this example the coefficients range from 0.88 to 0.98 , controlled by a phasor~ object (no relation). The phasor~ is converted to a symmetrical triangle wave (abs($v1-0.5)) and then ranged appropriately.; #X obj 250 417 phasor~ 0.3; #X text 22 158 Many variations of this have been invented. A deeper effect can be obtained by using 12 all-pass filters and adding the outputs of the 4th , 8th. and 12th one to the original. Various stereo configurations are possible. Some people use 6 instead of the 4 stages used here. Controls can be added to change the frequency of sweeping and the range of the all-pass coeefficients.; #X obj 250 449 expr~ 1 - 0.03 - 0.6*abs($v1-0.5)*abs($v1-0.5); #X connect 3 0 6 0; #X connect 3 0 13 0; #X connect 5 0 8 0; #X connect 6 0 5 0; #X connect 7 0 10 0; #X connect 8 0 7 0; #X connect 9 0 12 0; #X connect 10 0 9 0; #X connect 11 0 13 1; #X connect 12 0 11 0; #X connect 13 0 4 0; #X connect 13 0 4 1; #X connect 15 0 17 0; #X connect 17 0 6 1; #X connect 17 0 5 1; #X connect 17 0 8 1; #X connect 17 0 7 1; #X connect 17 0 10 1; #X connect 17 0 9 1; #X connect 17 0 12 1; #X connect 17 0 11 1;
--- NEW FILE: filter-graph1.pd --- #N canvas -4 364 603 514 10; #X obj 145 292 f; #X obj 175 292 + 1; #X obj 46 160 t b b; #X msg 161 268 0; #X obj 125 355 sel 1; #X msg 48 218 0; #X msg 46 191 1; #X floatatom 452 292 7 0 0 0 - - -; #X obj 442 333 phasor~; #X obj 415 384 cos~; #X obj 450 384 cos~; #X obj 449 361 -~ 0.25; #X obj 46 134 inlet; #X obj 394 413 outlet~; #X obj 451 413 outlet~; #X obj 216 329 t f f; #X obj 217 391 outlet; #X msg 114 122 ; pd dsp 1; #X obj 125 332 >= $1; #X msg 498 333 0; #X obj 145 237 metro; #X text 166 7 filter-graph1 -- generate sinusoids to test a filter ; #X text 168 23 arg 1: number of steps - arg2: frequency range; #X text 40 53 This , together with its companion filter-graph2 , measure a filter's frequency and phase response. Here we count from 0 to n-1 (where n is the table size) and output the index and a complex sinusoid at each frequency to test.; #X text 222 192 fudge to estimate settling time; #X obj 487 67 loadbang; #X obj 487 105 t b b; #X obj 519 151 max 1; #X obj 487 128 f $2; #X obj 519 128 f $1; #X obj 487 151 /; #X obj 442 265 *; #X obj 217 367 pack; #X floatatom 500 183 5 0 0 0 - - -; #X floatatom 248 237 5 0 0 0 - - -; #X obj 487 86 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 202 173 expr max(50 , 40000/($f2*max($f1 , 1))); #X connect 0 0 1 0; #X connect 0 0 15 0; #X connect 0 0 18 0; #X connect 1 0 0 1; #X connect 2 0 6 0; #X connect 2 1 3 0; #X connect 2 1 17 0; #X connect 3 0 0 1; #X connect 4 0 5 0; #X connect 5 0 20 0; #X connect 6 0 20 0; #X connect 8 0 11 0; #X connect 8 0 9 0; #X connect 9 0 13 0; #X connect 10 0 14 0; #X connect 11 0 10 0; #X connect 12 0 2 0; #X connect 15 0 32 0; #X connect 15 1 31 0; #X connect 15 1 36 0; #X connect 18 0 4 0; #X connect 19 0 8 1; #X connect 20 0 0 0; #X connect 20 0 19 0; #X connect 25 0 35 0; #X connect 26 0 28 0; #X connect 26 1 29 0; #X connect 27 0 30 1; #X connect 28 0 30 0; #X connect 29 0 27 0; #X connect 30 0 31 1; #X connect 30 0 33 0; #X connect 30 0 36 1; #X connect 31 0 7 0; #X connect 31 0 8 0; #X connect 31 0 32 1; #X connect 32 0 16 0; #X connect 35 0 26 0; #X connect 36 0 20 1; #X connect 36 0 34 0; #X connect 36 0 32 1;
--- NEW FILE: D14.vibrato.pd --- #N canvas 80 10 709 653 12; #X obj 28 258 r trigger; #X obj 28 454 *~; #X obj 28 482 *~; #X floatatom 63 304 3 0 100 0 - - -; #X msg 460 493 ; trigger 0; #X obj 28 281 unpack; #X floatatom 28 304 1 0 100 0 - - -; #X obj 27 533 +~ 0.3; #X obj 27 559 cos~; #X obj 27 507 osc~; #X obj 63 323 mtof; #X obj 63 345 sqrt; #X obj 63 367 sqrt; #X text 572 461 <-- octave up; #X msg 460 416 ; trigger 1 60; #X msg 460 453 ; trigger 1 72; #X text 550 494 <-- release; #X text 556 512 is optional; #X obj 28 424 *~; #X obj 237 404 +~ 1; #N canvas 0 0 450 300 graph1 0; #X array array62 131 float 1; #A 0 0.970031 1 0.970031 0.881921 0.740952 0.555571 0.336891 0.0980184 -0.146729 -0.382682 -0.595698 -0.773009 -0.88 -0.9 -0.92 -0.92 -0.85773 -0.707109 -0.514106 -0.290288 -0.0490716 0.195086 0.427551 0.63439 0.803205 0.86 0.88 0.88 0.88 0.84 0.82 0.471402 0.242986 6.63397e-06 -0.242974 -0.471391 -0.671554 -0.831465 -0.941541 -0.995184 -0.989178 -0.923883 -0.803213 -0.68 -0.42 -0.24 0.1 0.4 0.6 0.7071 0.857723 0.956937 0.998795 0.980787 0.903994 0.773018 0.595708 0.382694 0.146742 -0.0980052 -0.336878 -0.55556 -0.7 -0.8 -0.88 -0.88 -0.88 -0.84 -0.82 -0.555582 -0.336903 -0.0980316 0.146716 0.38267 0.595687 0.773001 0.903983 0.980782 0.998796 0.956945 0.857737 0.707119 0.514117 0.290301 0.0490849 -0.195073 -0.427539 -0.63438 -0.803197 -0.923873 -0.989174 -0.995187 -0.94155 -0.83148 -0.671573 -0.471414 -0.242999 -1.99019e-05 0.242961 0.471379 0.671544 0.831458 0.88 0.9 0.9 0.88 0.803221 0.63441 0.08 -0.14 -0.28 -0.48 -0.64 -0.72 -0.857717 -0.956933 -0.998794 -0.98079 -0.904 -0.773026 -0.595719 -0.382706 -0.146755 0.097992 0.336866 0.555549 0.740934 0.881909 0.970025 1 0.970038; #X coords 0 1 130 -1 200 100 1; #X restore 246 508 graph; #X obj 237 356 tabosc4~ array62; #X floatatom 237 312 3 0 0 0 - - -; #X obj 237 333 / 6; #X obj 237 380 *~; #X floatatom 391 333 3 0 0 0 - - -; #X text 236 438 since we'll multiply ,; #X text 235 453 vibrato output should; #X text 235 470 be centered at 1 , not 0; #X text 273 384 multiply by vib depth; #X obj 391 361 / 6923; #X text 62 425 apply vibrato; #X text 66 453 fourth; #X text 69 469 power; #X text 97 537 waveform; #X text 96 517 simple; #X text 457 354 4/(exp(log(2)/1200)-1); #X text 461 335 conversion factor is; #X text 384 295 vibrato depth; #X text 383 312 in cents; #X text 228 274 vibrato speed; #X text 227 291 in Hertz; #X obj 28 392 adsr 0 100 200 100 300; #X obj 26 587 output~; #X text 88 9 USING ADSRS FOR PORTAMENTO AND ADDING VIBRATO TOO; #X text 43 30 Portamento can be treated as a special case of an ADSR envelope , with 100 percent sustain. Vibrato is properly computed in units of pitch , but it's also possible to do the job without having to convert from pitch to frequency units at the audio rate. To do this we just raise the "pitch" to the fourth power , so that it acts pseudo-exponentially. Rather than add vibrato to the ADSR output , we multiply a signal which controls relative frequency. The relative frequency change is one plus an oscillator.; #X text 439 626 updated for Pd version 0.39; #X text 45 185 The table below holds 6 cycles of vibrato with small variations to get a not-exactly-repeating vibrato. We thus have to divide vibrato frequency by six. You can just use a sine or triangle wave if you prefer.; #X text 573 426 <-- middle C; #X connect 0 0 5 0; #X connect 1 0 2 0; #X connect 1 0 2 1; #X connect 2 0 9 0; #X connect 3 0 10 0; #X connect 5 0 6 0; #X connect 5 1 3 0; #X connect 6 0 42 0; #X connect 7 0 8 0; #X connect 8 0 43 0; #X connect 8 0 43 1; #X connect 9 0 7 0; #X connect 10 0 11 0; #X connect 11 0 12 0; #X connect 12 0 42 1; #X connect 18 0 1 0; #X connect 18 0 1 1; #X connect 19 0 18 1; #X connect 21 0 24 0; #X connect 22 0 23 0; #X connect 23 0 21 0; #X connect 24 0 19 0; #X connect 25 0 30 0; #X connect 30 0 24 1; #X connect 42 0 18 0;
--- NEW FILE: H11.shelving.pd --- #N canvas 25 22 868 421 12; #N canvas 0 0 450 300 graph2 0; #X array $0-tab1 100 float 1; #A 0 1.39998 1.39868 1.3942 1.39349 1.38496 1.3772 1.36745 1.35633 1.34208 1.32931 1.31817 1.30372 1.28879 1.27458 1.25944 1.24351 1.22874 1.21386 1.19924 1.18487 1.17063 1.15653 1.14284 1.13144 1.11914 1.10722 1.09603 1.08515 1.07479 1.06474 1.05519 1.04606 1.03715 1.02899 1.02092 1.0128 1.00624 0.999291 0.992705 0.986255 0.980081 0.974014 0.969307 0.964106 0.959111 0.954207 0.949901 0.945593 0.941227 0.937556 0.933778 0.930231 0.926681 0.923353 0.920059 0.917466 0.914627 0.911849 0.9092 0.906745 0.904264 0.901469 0.900065 0.898006 0.896023 0.893895 0.892373 0.890666 0.889038 0.887483 0.885924 0.884597 0.883215 0.881537 0.880075 0.879619 0.878522 0.877414 0.876234 0.87571 0.874819 0.873886 0.873124 0.87241 0.871807 0.870763 0.870512 0.869952 0.869465 0.868958 0.868403 0.86826 0.867939 0.866731 0.867094 0.867762 0.867796 0.864339 0.872811 0.920535; #X coords 0 5 99 0 200 300 1; #X restore 621 28 graph; #X obj 29 245 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 37 289 3 0 0 0 - - -; #X text 676 334 frequency; #N canvas 876 177 375 255 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X msg 22 91 ; $1-pole 60 ; $1-zero 20; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 289 390 pd startup; #X floatatom 281 265 3 -99 99 0 - #0-pole -; #X text 559 316 gain=0; #X text 108 34 SHELVING FILTER; #X obj 29 378 filter-graph2 $0-tab1; #X obj 29 266 filter-graph1 100 22050; #X text 796 330 22050; #X obj 232 314 rpole~; #X obj 281 288 / 100; #X floatatom 335 264 4 -100 100 0 - #0-zero -; #X obj 335 287 / 100; #X obj 231 346 rzero~; #X text 608 21 5; #X text 616 327 0; #X text 604 258 1; #X text 16 58 This patch demonstrates using the raw filters , rpole~ and rzero~ (raw , real-valued one-pole and one-zero filters) , to make a shelving filter.; #X text 14 109 If the pole is at p and the zero is at q , the gain at DC is (1-q)/(1-p) and the gain at Nyquist is (1+q)/(1+p). If the pole location is close to plus or minus one , this can give large gains unless q is in the same vicinity. (try , for example , p=90% , q=70%).; #X text 11 191 The crossover region varies from DC to Nyquist as p and q decrease from 100% to -100%.; #X text 278 241 pole; #X text 334 241 zero; #X text 383 263 (in hundredths); #X text 610 387 updated for Pd version 0.39; #X connect 1 0 9 0; #X connect 5 0 12 0; #X connect 9 0 2 0; #X connect 9 0 8 0; #X connect 9 1 8 1; #X connect 9 1 11 0; #X connect 9 2 8 2; #X connect 11 0 15 0; #X connect 12 0 11 1; #X connect 13 0 14 0; #X connect 14 0 15 1; #X connect 15 0 8 3;
--- NEW FILE: H01.low-pass.pd --- #N canvas 97 42 601 612 12; #X obj 72 411 mtof; #X floatatom 72 388 5 0 0 0 - #0-pit -; #X obj 41 542 output~; #X obj 41 457 lop~; #X obj 42 354 noise~; #X text 124 387 <-- cutoff (pitch units); #X text 135 434 <-- cutoff (Hertz); #X floatatom 72 436 5 0 0 0 - - -; #X text 348 582 updated for Pd version 0.39; #X text 88 459 low-pass filter; #X obj 130 535 tabwrite~ H01-graph; #X obj 130 510 metro 250; #X obj 130 490 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 148 487 graphing on/off; #N canvas 0 0 450 300 graph2 0; #X array H01-graph 882 float 3; #A 0 -0.107788 -0.0695636 -0.0991016 -0.104581 -0.0683972 -0.0547128 -0.0857414 -0.0731684 -0.0892636 -0.115914 -0.0935128 -0.0572466 -0.0387586 -0.0429956 -0.03826 -0.0628797 -0.0383263 -0.0720175 -0.0923909 -0.0707558 -0.0792164 -0.102187 -0.0888189 -0.119908 -0.083863 -0.0677126 -0.0554309 -0.044719 -0.0248649 -0.0482707 -0.0692472 -0.103905 -0.101273 -0.117807 -0.100956 -0.0905779 -0.0676211 -0.0299763 -0.0190183 0.00623894 -0.000664497 0.0291359 0.0310484 0.0412564 0.0375735 0.0676889 0.0348717 0.00747152 0.0416666 0.0529021 0.0418099 0.0405759 0.0303367 -0.00428127 0.0140712 -0.0111072 0.0243947 -0.0104408 -0.0142505 -0.0287291 -0.0119835 0.00876151 -0.0281321 -0.0325635 -0.0618363 -0.0379124 -0.0447592 -0.0507954 -0.0403398 -0.0277581 -0.00226383 0.000989536 -0.0323217 -0.0164512 -0.0156964 -0.0436928 -0.045223 -0.0706908 -0.0382667 -0.00177098 0.0290649 0.0149072 0.0483574 0.0453535 0.0100187 -0.00270613 0.0298578 0.0470317 0.0301263 0.0478455 0.0134859 0.0488288 0.0766369 0.0916206 0.11869 0.0944563 0.102745 0.086215 0.0845207 0.0662227 0.0609466 0.0952278 0.0771313 0.103073 0.101067 0.0915918 0.100309 0.0651311 0.0553397 0.0623315 0.050316 0.0844677 0.0996978 0.0715106 0.084598 0.0947672 0.115172 0.134093 0.118854 0.106047 0.120693 0.0961966 0.0571329 0.0854602 0.084371 0.0538877 0.0744577 0.0563968 0.0753962 0.0748331 0.0605493 0.0795627 0.0600295 0.0432455 0.0582205 0.0920203 0.0640656 0.0253824 -0.008527 -0.0243436 -0.0588714 -0.0239946 0.00784105 0.0119875 0.0161209 0.00780566 0.00216991 -0.0288565 -0.0521791 -0.0658445 -0.0868191 -0.0673713 -0.0889776 -0.0546807 -0.0256506 -0.0375237 -0.0118962 -0.0477717 -0.0384217 -0.0385089 -0.0696784 -0.098759 -0.121121 -0.127174 -0.157189 -0.121443 -0.0989412 -0.0615983 -0.0711882 -0.0760313 -0.0566161 -0.056104 -0.0875121 -0.0734271 -0.037525 -0.0681574 -0.0689616 -0.0900591 -0.0574559 -0.04051 -0.0333117 -0.0260634 -0.0202531 -0.0302473 -0.0346772 -0.052936 -0.0798849 -0.0780231 -0.111591 -0.112165 -0.129226 -0.11253 -0.138539 -0.122338 -0.138645 -0.132606 -0.112523 -0.139122 -0.169654 -0.132431 -0.136376 -0.130106 -0.110972 -0.113595 -0.131592 -0.141568 -0.108734 -0.075847 -0.0711363 -0.0525791 -0.0216604 -0.0196736 -0.0186081 -0.0186695 -0.00602199 0.0257979 0.0132076 0.0225488 0.00748564 0.0165994 0.00166184 -0.00116405 0.0028765 0.01807 0.0157059 0.0473739 0.0708991 0.0862786 0.0650413 0.038138 0.015989 0.0521245 0.0605891 0.0431341 0.00429233 0.028138 0.00477928 0.00181729 -0.028107 -0.0360127 -0.00712468 -0.0312668 -0.0523252 -0.0479352 -0.0513783 -0.0250772 -0.0142933 -0.047864 -0.0252179 -0.0219197 0.0153334 0.0518051 0.082624 0.0535017 0.0535462 0.0506847 0.0717359 0.0774448 0.0591473 0.0602611 0.0708395 0.0654832 0.0261038 0.0107588 0.00770543 0.0203729 0.033363 0.029335 0.0483838 0.0607855 0.0245724 0.0550305 0.0593506 0.0753188 0.081294 0.096557 0.117197 0.105438 0.111979 0.0953627 0.0978146 0.084516 0.0952146 0.117297 0.0851524 0.0863281 0.049295 0.0757788 0.0866482 0.0738062 0.0984422 0.0885168 0.116305 0.0949217 0.0562471 0.0898681 0.0643755 0.0681146 0.0863296 0.0516047 0.0595782 0.0605373 0.0295923 0.0568693 0.0749412 0.0804035 0.108818 0.0786603 0.0506026 0.0129134 0.0381891 0.0305477 0.0364073 0.0411764 0.0721042 0.0629199 0.03039 0.0474877 0.0100055 0.0283331 0.0424028 0.0700528 0.0932837 0.116089 0.146493 0.171112 0.198628 0.1636 0.135356 0.164266 0.144544 0.132615 0.128501 0.129495 0.141165 0.145633 0.141941 0.170706 0.193988 0.204823 0.228202 0.219125 0.204054 0.227319 0.231326 0.230171 0.204664 0.230591 0.189557 0.202459 0.184563 0.212896 0.202201 0.221436 0.214395 0.195221 0.209657 0.214416 0.202139 0.222888 0.237836 0.245874 0.22457 0.194835 0.159835 0.142986 0.120742 0.119331 0.147719 0.17693 0.157802 0.153323 0.151851 0.155677 0.148854 0.139333 0.145233 0.166518 0.140436 0.150237 0.126701 0.135908 0.166416 0.15391 0.152768 0.181048 0.149057 0.136385 0.1213 0.144767 0.113465 0.0980506 0.0852771 0.106682 0.130461 0.10524 0.0793894 0.07123 0.0447812 0.0792345 0.0479509 0.0700904 0.0308896 0.0279068 0.0312166 0.010152 -0.00943106 0.0010242 -0.00752998 0.0143407 0.0027725 0.033508 0.0621824 0.0643498 0.0827609 0.113321 0.11629 0.139206 0.101752 0.0988734 0.107286 0.128068 0.14154 0.148363 0.124029 0.0968996 0.127442 0.100244 0.0940884 0.0805303 0.103963 0.0874826 0.0588413 0.0720198 0.0853478 0.0902383 0.0788942 0.0475014 0.0707652 0.0384297 0.0538394 0.0763012 0.0483987 0.0713554 0.0473328 0.0415702 0.0532321 0.0475937 0.0208587 0.0030926 0.00438177 -0.0204396 -0.00825569 0.0180096 0.0456204 0.0765333 0.0938012 0.110089 0.115665 0.13934 0.144259 0.155082 0.164549 0.192087 0.159342 0.176142 0.149727 0.174968 0.170935 0.134127 0.123663 0.11653 0.113447 0.102327 0.0764594 0.0887578 0.079355 0.0692447 0.0727442 0.0913222 0.115159 0.137636 0.154978 0.176904 0.156243 0.13039 0.104399 0.0853428 0.0666318 0.0615526 0.0907602 0.0502914 0.0434091 0.00788628 -0.0191843 -0.0395026 -0.0596938 -0.0723036 -0.0806951 -0.0861116 -0.0864571 -0.0488058 -0.0711986 -0.0797166 -0.0688114 -0.0318625 -0.0673463 -0.0444878 -0.0250519 -0.024727 -0.0310858 -0.00561093 -0.0207001 -0.0340927 -0.0551734 -0.0817888 -0.0705976 -0.0835859 -0.0866976 -0.0565736 -0.0797509 -0.0968247 -0.0655236 -0.0760219 -0.0670947 -0.0342146 -0.0274503 -0.0263804 -0.0317333 -0.039663 -0.0119034 -0.046866 -0.0359958 -0.0318836 -0.0499625 -0.0574402 -0.029796 0.0028338 -0.0262898 -0.041154 -0.0473188 -0.0255545 -0.058172 -0.0601881 -0.0914168 -0.102286 -0.135733 -0.13837 -0.13175 -0.139201 -0.160906 -0.136196 -0.11435 -0.073056 -0.0694626 -0.0599314 -0.0349573 -0.00661064 -0.0128436 -0.0368892 -0.00783622 -0.0285016 -0.0257515 -0.000656539 0.000578916 0.00997914 0.0309158 0.00448781 -0.0276183 -0.00975017 -0.0431335 -0.0420573 -0.0318631 -0.0461821 -0.0493957 -0.0468264 -0.0278063 -0.0239267 -0.0240269 -0.0446192 -0.0791041 -0.0634024 -0.0949552 -0.122094 -0.130089 -0.110653 -0.07832 -0.0717672 -0.0448359 -0.0454325 -0.075843 -0.0655465 -0.0499949 -0.0848139 -0.107986 -0.0831531 -0.0721088 -0.103859 -0.0650817 -0.0753315 -0.0991717 -0.072808 -0.0810555 -0.0679525 -0.0566175 -0.0827188 -0.0822597 -0.0497494 -0.0154982 -0.00131288 0.0318942 -0.00235687 -0.0344436 -0.0249813 -0.00212817 0.0348011 0.0207401 0.00218581 -0.0346692 -0.000621661 -0.0106329 -0.0261485 0.00856931 -0.0171581 0.0152674 0.0466481 0.0456615 0.0728295 0.0601254 0.0639082 0.0949887 0.09166 0.118261 0.120631 0.120818 0.150657 0.154468 0.134964 0.0965974 0.0907992 0.069314 0.0611587 0.0707784 0.0627047 0.0717109 0.0659585 0.0296832 0.0352495 0.00141861 0.010894 0.0426848 0.0419218 0.0141017 0.0413311 0.037778 0.0154291 0.0312945 0.00510286 -0.00271059 -0.0291284 -0.045397 -0.0762688 -0.0445058 -0.057707 -0.0779557 -0.0735523 -0.0922772 -0.0727918 -0.0429784 -0.00911861 -0.0379944 -0.0658339 -0.0784915 -0.0792981 -0.0453014 -0.0197867 -0.00123178 0.000799734 -0.00204599 0.0349492 0.0623098 0.0770006 0.0882193 0.0484045 0.0760622 0.0945022 0.0567368 0.0286078 0.00189384 0.0315546 0.0374527 0.0395075 0.0591211 0.0415475 0.0732162 0.0588977 0.0850963 0.0465228 0.0698241 0.0407602 0.0431113 0.0065717 0.00936337 0.0222241 0.0327647 0.0270807 -0.0111891 0.0063837 -0.0086459 -0.0364951 -0.0200965 -0.0318325 -0.0576028 -0.0557316 -0.0675803 -0.0887475 -0.0980934 -0.0881446 -0.117229 -0.125822 -0.13378 -0.142539 -0.108397 -0.13497 -0.138471 -0.164523 -0.174647 -0.18636 -0.157472 -0.148646 -0.108121 -0.104372 -0.0695942 -0.0542974 -0.0701001 -0.100999 -0.0658883 -0.0947834 -0.113894 -0.0981114 -0.108426 -0.100378 -0.102227 -0.0818266 -0.103135 -0.0720306 -0.0440222 -0.0219618 -0.0453231 -0.019184 0.0157131 -0.013545 -0.0248696 -0.0166098 -0.0489199 -0.0269982 -0.0224125 -0.0413912 -0.0728588 -0.0586017 -0.0349842 -0.0338855 -0.0588961 -0.0928709 -0.11376 -0.0790886 -0.100094 -0.126293 -0.10676 -0.136216 -0.109541 -0.136053 -0.112742 -0.136117 -0.146529 -0.156998 -0.163319 -0.137112 -0.146644 -0.138866 -0.159482 -0.185248 -0.206002 -0.16925 -0.178855 -0.140085 -0.105426 -0.095303 -0.0736452 -0.066341 -0.0689736 -0.0914969 -0.0725721 -0.0824288 -0.049098 -0.0139474 -0.00957104 0.0134051 -0.0091349 0.00555033 0.0117049 -0.0230348 -0.0545547 -0.050228 -0.0431037 -0.0668625 -0.029803 -0.0551605 -0.0175891 -0.0435808 -0.0240586 -0.0455508 -0.00746894 0.0213663 0.0569028 0.0190693 0.000740271 0.000412262 -0.0233437 -0.0205415 -0.0240432 0.00448952 0.00916993 0.00155166 -0.00567939 -0.00725616 0.0138388 0.0162082 -0.00138934 -0.0077004 -0.0261998 -0.0100701 -0.0337348 -0.0154704 -0.0291058 -0.0299364 -0.00924212 0.0247502 -0.0060416 -0.0118114 -0.0158459 0.0158545 -0.00827235 -0.00602365 -0.0132283 0.0105079 0.0432025 0.0698796 0.0576105 0.0538253 0.066991 0.0715161 0.0405482 0.0741857 0.0802094 0.113967 0.126283 0.111464 0.0926309 0.0545991 0.0568134 0.0770984 0.0533353 0.0142316 -0.0181225 0.00490977 0.0275315 0.0202685 0.00414232 0.0273551 0.0158572 -0.00476758 -0.0362654 -0.0701252 -0.0547324 -0.0708724 -0.0970369 -0.099428 -0.102544 -0.0736354 -0.0556618 -0.0863601; #X coords 0 1 882 -1 200 140 1; #X restore 384 386 graph; #X text 408 528 --- 0.02 sec ---; #X text 28 30 This and the following patches show how to use filters in Pd , starting with the simplest one: the one-pole low-pass filter. Here we test it with an input of white noise. The lop~ object does the filtering. Its left inlet takes an audio signal to be filtered , and its right inlet takes messages to set its cutoff frequency in Hertz.; #X text 26 129 The lop~ object is normalized to pass DC (the lowest frequency) with a gain of one. Higher frequencies are progressively more and more attenuated. The lower the cutoff frequency , the lower the total power of the filtered noise. If you graph the output you'll see that the waveform gets smoother (and smaller overall) as the cutoff frequency is lowered.; #X text 28 243 At the cutoff frequency the gain is about -3 dB , and above that the gain drops a further 6 dB per octave. (Sometimes one uses the word "rolloff" instead of "cutoff" to emphasize the gradual way the gain drops off with frequency.); #X text 108 353 white noise , test signal; #X text 185 6 ONE-POLE LOW-PASS FILTER; #N canvas 0 0 450 300 loadbang 0; #X obj 85 16 loadbang; #X obj 85 40 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 85 59 f $0; #X text 18 179 boxes.; #X text 16 161 This subpatch loads initial values in number; #X msg 84 83 ; $1-pit 60; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 129 582 pd loadbang; #X connect 0 0 7 0; #X connect 1 0 0 0; #X connect 3 0 2 0; #X connect 3 0 2 1; #X connect 3 0 10 0; #X connect 4 0 3 0; #X connect 7 0 3 1; #X connect 11 0 10 0; #X connect 12 0 11 0;
--- NEW FILE: H04.filter.sweep.pd --- #N canvas 360 15 553 524 12; #X floatatom 44 146 5 0 150 0 - #0-pitch -; #X text 126 9 SWEEPING FILTERS; #X obj 44 193 phasor~; #X obj 59 351 +~; #X floatatom 81 326 5 0 100 0 - #0-offset -; #X floatatom 60 222 5 0 0 0 - #0-speed -; #X floatatom 82 273 5 0 100 0 - #0-depth -; #X floatatom 75 404 5 0 1000 0 - #0-q -; #X obj 44 426 vcf~; #X obj 59 375 tabread4~ mtof; #X text 127 403 <-- Q (selectivity); #X text 115 182 sawtooth; #X text 116 198 oscillator; #X text 112 221 <-- sweep speed; #X text 137 245 LFO for sweep; #X text 134 274 <-- sweep depth; #X text 131 326 <-- base center frequency; #X text 103 350 add base to sweep; #X text 192 375 convert to Hz.; #X text 97 144 <-- pitch; #X obj 43 457 output~; #X obj 44 169 mtof; #X obj 60 244 phasor~; #X obj 60 298 *~; #X text 294 496 updated for Pd version 0.39; #N canvas 706 247 450 300 startup 0; #X obj 85 16 loadbang; #X obj 85 40 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 85 59 f $0; #X text 9 257 boxes.; #X text 18 209 This subpatch loads initial values in number; #X msg 85 83 ; $1-pitch 48 ; $1-speed -2 ; $1-depth 27 ; $1-offset 56 ; $1-q 2; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 168 491 pd startup; #X text 14 109 Note the different effects of negative and positive sweep speeds.; #X text 13 32 If you want actively changing center frequencies , use "vcf~" instead of "bp~". The vcf~ module takes an audio signal to set center frequency. (Q is still set by messages though.) Vcf is computationally somewhat more expensive than bp~.; #X connect 0 0 21 0; #X connect 2 0 8 0; #X connect 3 0 9 0; #X connect 4 0 3 1; #X connect 5 0 22 0; #X connect 6 0 23 1; #X connect 7 0 8 2; #X connect 8 0 20 0; #X connect 8 0 20 1; #X connect 9 0 8 1; #X connect 21 0 2 0; #X connect 22 0 23 0; #X connect 23 0 3 0;
--- NEW FILE: H02.high-pass.pd --- #N canvas 29 10 607 643 12; #X obj 38 563 output~; #X text 336 611 updated for Pd version 0.39; #X obj 126 544 metro 250; #X obj 126 524 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 144 521 graphing on/off; #N canvas 0 0 450 300 graph2 0; #X array H02-graph 882 float 3; #A 0 0.86084 0.876465 0.891113 0.904785 0.917725 0.929688 0.940918 0.950928 0.960205 0.968506 0.97583 0.982178 0.987793 0.992188 0.995605 0.998047 0.999512 1 0.999756 0.998291 0.99585 0.992432 0.988037 0.982666 0.976318 0.968994 0.960938 0.95166 0.94165 0.930664 0.918701 0.905762 0.89209 0.877441 0.862061 0.845703 0.828613 0.810547 0.791748 0.772217 0.751953 0.730957 0.709229 0.686768 0.663574 0.639893 0.615479 0.590576 0.564941 0.538818 0.511963 0.484863 0.457275 0.429199 0.400635 0.371826 0.342529 0.312744 0.282959 0.252686 0.222168 0.19165 0.160645 0.129639 0.0986328 0.0673828 0.0358887 0.00463867 -0.0266113 -0.0581055 -0.0893555 -0.120361 -0.151611 -0.182373 -0.213135 -0.243652 -0.273926 -0.303955 -0.33374 -0.363037 -0.39209 -0.420654 -0.448975 -0.476807 -0.50415 -0.530762 -0.557129 -0.583008 -0.608154 -0.632568 -0.656738 -0.679932 -0.702637 -0.724609 -0.74585 -0.766357 -0.786133 -0.805176 -0.823242 -0.840576 -0.857178 -0.873047 -0.887939 -0.901855 -0.915039 -0.927246 -0.938477 -0.94873 -0.958252 -0.966797 -0.974365 -0.980957 -0.986572 -0.991211 -0.994873 -0.997559 -0.999268 -1 -0.999756 -0.998535 -0.996338 -0.993164 -0.989014 -0.983887 -0.977783 -0.970947 -0.962891 -0.953857 -0.944092 -0.933105 -0.921387 -0.908936 -0.895264 -0.880859 -0.865479 -0.849365 -0.83252 -0.814697 -0.796143 -0.776855 -0.756592 -0.73584 -0.714111 -0.691895 -0.668945 -0.645264 -0.621094 -0.596191 -0.570801 -0.544678 -0.518066 -0.491211 -0.463623 -0.435547 -0.407227 -0.378418 -0.349121 -0.31958 -0.289795 -0.259521 -0.229248 -0.198486 -0.167725 -0.136719 -0.105713 -0.0744629 -0.0432129 -0.0117188 0.0195312 0.0507812 0.0822754 0.113281 0.144531 0.175293 0.206055 0.236816 0.26709 0.297119 0.326904 0.356445 0.385498 0.414307 0.442627 0.470459 0.497803 0.524902 0.55127 0.577148 0.602539 0.627197 0.651367 0.674805 0.69751 0.719727 0.740967 0.761719 0.781738 0.800781 0.819336 0.836914 0.853516 0.869385 0.884521 0.898682 0.912109 0.924561 0.936035 0.946533 0.956299 0.964844 0.972656 0.979492 0.985352 0.990234 0.994141 0.99707 0.999023 1 1 0.999023 0.99707 0.994141 0.990234 0.985352 0.979248 0.972412 0.964844 0.956055 0.946289 0.935791 0.924316 0.911865 0.898438 0.884277 0.869141 0.853271 0.836426 0.818848 0.800537 0.78125 0.76123 0.740723 0.719238 0.697021 0.674316 0.650879 0.626709 0.601807 0.57666 0.550781 0.52417 0.497314 0.469971 0.441895 0.413574 0.38501 0.355713 0.326416 0.296631 0.266357 0.236084 0.205566 0.174805 0.143799 0.112793 0.081543 0.050293 0.0187988 -0.0124512 -0.0437012 -0.0749512 -0.106201 -0.137451 -0.168457 -0.199219 -0.229736 -0.260254 -0.290283 -0.320068 -0.349609 -0.378906 -0.407715 -0.436035 -0.464111 -0.491699 -0.518799 -0.545166 -0.571289 -0.59668 -0.621582 -0.645752 -0.669434 -0.692383 -0.7146 -0.736328 -0.75708 -0.7771 -0.796631 -0.815186 -0.832764 -0.849854 -0.865967 -0.881104 -0.895508 -0.90918 -0.921631 -0.93335 -0.944092 -0.954102 -0.962891 -0.970947 -0.978027 -0.984131 -0.989258 -0.993408 -0.996582 -0.998779 -0.999756 -1 -0.999268 -0.997559 -0.994873 -0.991211 -0.986328 -0.980713 -0.974121 -0.966553 -0.958008 -0.94873 -0.938232 -0.927002 -0.914551 -0.901611 -0.887451 -0.872559 -0.856934 -0.840332 -0.822998 -0.804688 -0.785645 -0.765869 -0.745361 -0.724121 -0.702148 -0.679443 -0.65625 -0.63208 -0.607666 -0.582275 -0.556641 -0.530273 -0.503418 -0.476074 -0.448242 -0.420166 -0.391357 -0.362305 -0.333008 -0.303223 -0.273193 -0.24292 -0.212402 -0.181885 -0.150879 -0.119873 -0.088623 -0.057373 -0.026123 0.00537109 0.0366211 0.0678711 0.0991211 0.130371 0.161377 0.192139 0.2229 0.253418 0.283447 0.313477 0.343018 0.372314 0.401123 0.429688 0.457764 0.485352 0.512695 0.539307 0.56543 0.591064 0.615967 0.640381 0.664062 0.687256 0.709717 0.731445 0.752441 0.772705 0.792236 0.811035 0.828857 0.845947 0.862305 0.877686 0.892334 0.906006 0.918945 0.930908 0.941895 0.951904 0.961182 0.969238 0.976562 0.98291 0.988037 0.992432 0.99585 0.998291 0.999756 1 0.999512 0.998047 0.995605 0.991943 0.987549 0.982178 0.97583 0.968506 0.960205 0.950928 0.940674 0.929443 0.91748 0.904541 0.890869 0.876221 0.860596 0.844238 0.826904 0.808838 0.790039 0.770508 0.75 0.729004 0.707275 0.684814 0.661621 0.637695 0.613281 0.588135 0.5625 0.536377 0.509521 0.482422 0.45459 0.426514 0.397949 0.369141 0.339844 0.310059 0.280029 0.25 0.219482 0.188721 0.157959 0.126953 0.0957031 0.0644531 0.0332031 0.00170898 -0.029541 -0.060791 -0.092041 -0.123291 -0.154297 -0.185303 -0.21582 -0.246338 -0.276611 -0.306641 -0.336426 -0.365723 -0.394775 -0.42334 -0.451416 -0.479248 -0.506592 -0.533203 -0.55957 -0.585205 -0.610352 -0.63501 -0.658691 -0.682129 -0.70459 -0.726562 -0.747803 -0.768066 -0.787842 -0.806885 -0.824951 -0.842285 -0.858643 -0.874268 -0.88916 -0.903076 -0.916016 -0.928223 -0.939453 -0.949707 -0.958984 -0.967529 -0.974854 -0.981445 -0.987061 -0.991455 -0.995117 -0.997803 -0.999512 -1 -0.999756 -0.998535 -0.996094 -0.99292 -0.98877 -0.983398 -0.977295 -0.970215 -0.962158 -0.953125 -0.943115 -0.932129 -0.92041 -0.907715 -0.894043 -0.879639 -0.864258 -0.8479 -0.831055 -0.812988 -0.794434 -0.774902 -0.754883 -0.733887 -0.712158 -0.689941 -0.666748 -0.643066 -0.618896 -0.593994 -0.568359 -0.542236 -0.515625 -0.488525 -0.460938 -0.433105 -0.404541 -0.375732 -0.346436 -0.316895 -0.286865 -0.256836 -0.226318 -0.195801 -0.165039 -0.134033 -0.102783 -0.0715332 -0.0402832 -0.0090332 0.0224609 0.0537109 0.0849609 0.116211 0.147217 0.178223 0.208984 0.239502 0.269775 0.299805 0.32959 0.359131 0.388184 0.416748 0.445068 0.4729 0.500244 0.527344 0.553711 0.579346 0.604736 0.629395 0.65332 0.676758 0.699463 0.72168 0.74292 0.763672 0.783447 0.80249 0.820801 0.838379 0.85498 0.87085 0.885742 0.899902 0.913086 0.925537 0.937012 0.94751 0.957031 0.965576 0.973389 0.97998 0.98584 0.990723 0.994385 0.997314 0.999023 1 1 0.998779 0.996826 0.993652 0.989746 0.984619 0.97876 0.971924 0.963867 0.955078 0.945312 0.934814 0.923096 0.910645 0.897217 0.882812 0.867676 0.851807 0.834961 0.817139 0.798828 0.779541 0.759521 0.73877 0.717285 0.695068 0.672119 0.648682 0.624512 0.599609 0.574219 0.54834 0.521729 0.494873 0.467285 0.439453 0.411133 0.382324 0.353027 0.32373 0.293701 0.263672 0.233398 0.202637 0.171875 0.140869 0.109863 0.0786133 0.0473633 0.0161133 -0.0153809 -0.0466309 -0.0778809 -0.109131 -0.140137 -0.171143 -0.201904 -0.232666 -0.262939 -0.292969 -0.322754 -0.352295 -0.381592 -0.4104 -0.438721 -0.466553 -0.494141 -0.52124 -0.547607 -0.57373 -0.599121 -0.623779 -0.647949 -0.671631 -0.694336 -0.716797 -0.738281 -0.759033 -0.779053 -0.79834 -0.81665 -0.834473 -0.851318 -0.867432 -0.882568 -0.896729 -0.910156 -0.922852 -0.934326 -0.945068 -0.954834 -0.963867 -0.97168 -0.978516 -0.984619 -0.989502 -0.993652 -0.996826 -0.998779 -1 -1 -0.999268 -0.997314 -0.994629 -0.990723 -0.98584 -0.980225 -0.973633 -0.96582 -0.957275 -0.947754 -0.937256 -0.925781 -0.913574 -0.900391 -0.88623 -0.871338 -0.855469 -0.838867 -0.821289 -0.802979 -0.783936 -0.76416 -0.743408 -0.722168 -0.700195 -0.67749 -0.654053 -0.629883 -0.605225 -0.580078 -0.554199 -0.527832 -0.500977 -0.473633 -0.445801 -0.41748 -0.388916 -0.359863 -0.330322 -0.300537 -0.270508 -0.240234 -0.209717 -0.178955 -0.147949 -0.116943 -0.0856934 -0.0544434 -0.0231934 0.00805664 0.0395508 0.0708008 0.102051 0.133057 0.164062 0.195068 0.225586 0.256104 0.286133 0.316162 0.345703 0.375 0.403809 0.432373 0.460449 0.488037 0.515137 0.541748 0.567871 0.593262 0.618164 0.642578 0.66626 0.689209 0.71167 0.733398 0.754395 0.774414 0.793945 0.812744 0.830566 0.847656 0.86377 0.87915 0.893555 0.907227 0.919922 0.931885 0.942871 0.952881 0.961914 0.969971 0.977051 0.983398 0.988525 0.99292 0.996094 0.998535 0.999756 1 0.999512 0.997803 0.995361 0.991699 0.987061 0.981689 0.975098 0.967773 0.959229 0.949951 0.939697 0.928467 0.916504 0.90332 0.889404 0.874756 0.859131 0.842529 0.825439 0.807129 0.78833 0.768555 0.748291 0.727051 0.705078 0.682617 0.659424 0.635498 0.611084 0.585938 0.560059 0.533936 0.50708 0.47998 0.452148 0.424072 0.395508 0.366455 0.337158 0.307373 0.277344 0.24707 0.216553 0.186035 0.155029 0.124023 0.0927734 0.0615234 0.0302734 -0.000976562 -0.0324707 -0.0637207 -0.0949707 -0.125977 -0.157227 -0.187988 -0.21875 -0.249268 -0.279297 -0.309326 -0.339111 -0.368408; #X coords 0 1 882 -1 200 140 1; #X restore 381 407 graph; #X text 405 549 --- 0.02 sec ---; #X text 24 31 Many synthesis algorithms and transformations can have outputs with a zero-freqency component (commonly called DC for "direct current"). These are inaudible and sometimes cause distortion in audio output devices , or when converting to fixed-point soundfile formats. It is often desirable to filter an audio signal to remove its DC component. ; #X text 23 147 The simplest way to do this is to use a one-pole low-pass filter , tuned to a low frequency such as 3 Hertz , and to subtract its output from the original. This difference is called a one-pole , one-zero high-pass filter , and it is used so often that Pd provides one in the "hip~" object.; #X obj 38 354 +~ 1; #X obj 37 491 hip~ 5; #X text 100 491 high-pass filter; #X floatatom 86 450 5 0 0 0 - - -; #X msg 86 380 0; #X text 122 329 sinusoidal test signal; #X text 83 354 add "DC"; #X text 124 380 zero for no filtering; #X msg 86 403 3; #X text 121 404 3 (or so) to remove DC; #X text 126 427 higher freqencies affect; #X text 166 443 the audible part of; #X text 166 459 the signal as well.; #X obj 38 329 osc~ 220; #X msg 86 426 220; #X text 23 229 The simplest way to do this is to use a one-pole low-pass filter , tuned to a low frequency such as 3 Hertz , and to subtract its output from the original. This difference is computed by a one-pole , one-zero high-pass filter. These are used so often that Pd provides one in the "hip~" object.; #X text 131 4 ONE-POLE , ONE-ZERO HIGH-PASS FILTER; #X obj 126 569 tabwrite~ H02-graph; #X connect 2 0 26 0; #X connect 3 0 2 0; #X connect 9 0 10 0; #X connect 10 0 0 0; #X connect 10 0 0 1; #X connect 10 0 26 0; #X connect 12 0 10 1; #X connect 13 0 12 0; #X connect 17 0 12 0; #X connect 22 0 9 0; #X connect 23 0 12 0;
--- NEW FILE: H09.ssb.modulation.pd --- #N canvas 7 6 605 578 12; #X obj 188 393 cos~; #X obj 231 371 +~ -0.25; #X obj 231 394 cos~; #X obj 23 438 *~; #X obj 89 438 *~; #X obj 22 462 -~; #X floatatom 188 322 5 0 0 0 - - -; #X text 30 242 sample loop for; #X text 30 260 test signal; #X text 35 321 pair of allpass; #X text 34 338 filters to make; #X text 34 356 90 degree phase; #X text 32 373 shifted versions; #X text 238 323 <-- shift frequency; #X text 310 356 cosine and sine waves; #X text 55 7 SINGLE SIDEBAND MODULATION; #X text 300 7 (AKA FREQUENCY SHIFTING); #N canvas 555 154 448 326 bell-loop 0; #X obj 23 142 /; #X obj 23 214 +~ 1; #X msg 23 117 44100; #X obj 23 91 t b f; #X obj 24 264 outlet~; #N canvas 0 0 450 300 graph1 0; #X array $0-array 155948 float 0; #X coords 0 1 155947 -1 200 150 1; #X restore 234 88 graph; #X obj 23 67 r $0-totsamps; #X obj 65 190 r $0-totsamps; #X obj 23 190 *~; #X obj 23 166 phasor~; #X obj 23 238 tabread4~ $0-array; #X connect 0 0 9 0; #X connect 1 0 10 0; #X connect 2 0 0 0; #X connect 3 0 2 0; #X connect 3 1 0 1; #X connect 6 0 3 0; #X connect 7 0 8 1; #X connect 8 0 1 0; #X connect 9 0 8 0; #X connect 10 0 4 0; #X restore 24 279 pd bell-loop; #N canvas 711 110 483 471 startup 0; #X obj 53 335 r readfile; #X obj 53 388 soundfiler; #X obj 59 23 loadbang; #X obj 59 49 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 59 70 f $0; #X obj 60 271 /; #X msg 60 248 44100; #X obj 60 223 t b f; #X obj 60 199 r $0-totsamps; #X obj 60 294 s $0-loopf; #X msg 53 361 read -resize ../sound/bell.aiff $1; #X msg 59 102 ; readfile symbol $1-array ; $1-totsamps 143718; #X connect 0 0 10 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 0 11 0; #X connect 5 0 9 0; #X connect 6 0 5 0; #X connect 7 0 6 0; #X connect 7 1 5 1; #X connect 8 0 7 0; #X connect 10 0 1 0; #X restore 157 530 pd startup; #X obj 21 495 output~; #X text 352 547 updated for Pd version 0.39; #X obj 188 347 phasor~; #X text 123 438 <-- complex multipier; #X text 122 455 (calculates real part); #X text 309 371 to form the real and; #X text 309 387 imaginary part of a; #X text 309 404 complex sinusoid; #X text 43 37 The signal sideband modulator gives you only one sideband for each frequency in the input signal (whereas ring modulation gave both a positive and negative sideband). You can set the shift frequency positive to shift all frequencies upward , or negative to shift them downwards.; #X text 42 117 The technique is to filter the input into two versions , 90 degrees out of phase , which can be interpreted as the real and imaginary part of a complex signal with positive frequencies only. You can then form the (complex) product of this with a (complex) sinusoid to modulate upward or downward in frequency.; #X obj 23 400 hilbert~; #X text 42 213 The "Hilbert~" object is an abstraction in pd/extra. ; #X connect 0 0 3 1; #X connect 1 0 2 0; #X connect 2 0 4 1; #X connect 3 0 5 0; #X connect 4 0 5 1; #X connect 5 0 19 0; #X connect 5 0 19 1; #X connect 6 0 21 0; #X connect 17 0 29 0; #X connect 21 0 1 0; #X connect 21 0 0 0; #X connect 29 0 3 0; #X connect 29 1 4 0;
--- NEW FILE: I01.Fourier.analysis.pd --- #N canvas 25 8 688 708 12; #X floatatom 38 264 7 0 0 0 - - -; #N canvas 0 0 450 300 graph1 0; #X array $0-real 64 float 2; #X coords 0 64 64 -64 256 200 1; #X restore 423 184 graph; #X floatatom 38 168 5 0 32 0 - - -; #X obj 78 240 samplerate~; #X obj 38 215 t f b; #X obj 38 240 *; #X obj 80 568 metro 250; #X obj 38 637 tabwrite~ $0-real; #X obj 67 614 tabwrite~ $0-imaginary; #X obj 38 384 osc~; #N canvas 0 0 450 300 graph1 0; #X array $0-imaginary 64 float 2; #X coords 0 64 64 -64 256 200 1; #X restore 423 417 graph; #X obj 69 360 f; #X floatatom 91 316 3 0 100 0 - - -; #X obj 91 337 / 100; #X obj 38 191 / 64; #X text 504 163 real part; #X text 489 398 imaginary part; #X obj 80 545 loadbang; #X text 94 166 <- frequency; #X text 133 182 (as multiple; #X text 135 198 of SR/64 , the; #X text 133 215 fundamental); #X text 170 345 of a cycle; #X text 431 638 updated for PD version 0.39; #X obj 89 590 s $0-snap; #X obj 69 286 r $0-snap; #X text 127 315 <- phase in; #X text 161 331 hundredths; #X text 113 264 <- frequency , Hz.; #X text 87 415 given the real and imaginary part; #X text 88 431 of a complex-valued signal. Here; #X text 87 447 the imaginary part is zero (the; #X text 86 400 fft~ computes the Fourier transform ,; #X text 186 541 real and imaginary; #X text 186 557 outputs are graphed; #X text 185 574 separately.; #X text 86 464 input is real-valued). The output; #X text 85 482 is a (real , imaginary) pair for each; #X text 86 500 frequency from 0 to 63 (in units of; #X text 87 520 SR/64).; #X text 145 -36 The "fft~" object has separate inlets for the real and imaginary parts of a complex-valued signal and outputs its Fourier transform , again using separate outlets for the real and imaginary part. The transform is done on one block of samples (here the block size is 64 , Pd's default.) The outputs give the complex amplitudes of the harmonics of the input signal , from DC up. The harmonics are tuned to the fundamental frequency of the analysis , 1/64th of the sample rate. If the frequency (in harmonics) is an integer , the result is two harmonics symmetric about the Nyquist frequency. Fractional frequencies spill across harmonics. Changing the initial phase rotates energy from real to imaginary and back.; #X text 26 -24 ANALYSIS; #X text 27 -42 FOURIER; #X msg 38 79 0; #X msg 38 100 10; #X msg 38 121 10.5; #X text 159 283 bang-on-snapshot; #X text 157 297 from below; #X text 100 363 sync phase with snapshots; #X obj 37 423 fft~; #X msg 274 614 ; pd dsp 1; #X connect 0 0 9 0; #X connect 2 0 14 0; #X connect 3 0 5 1; #X connect 4 0 5 0; #X connect 4 1 3 0; #X connect 5 0 0 0; #X connect 6 0 7 0; #X connect 6 0 8 0; #X connect 6 0 24 0; #X connect 9 0 49 0; #X connect 11 0 9 1; #X connect 12 0 13 0; #X connect 13 0 11 1; #X connect 14 0 4 0; #X connect 17 0 6 0; #X connect 17 0 50 0; #X connect 25 0 11 0; #X connect 43 0 2 0; #X connect 44 0 2 0; #X connect 45 0 2 0; #X connect 49 0 7 0; #X connect 49 1 8 0;
--- NEW FILE: butterworth3~.pd --- #N canvas -21 471 656 598 10; #X obj 59 313 rpole~; #X obj 58 379 cpole~; #X obj 82 410 cpole~; #X obj 58 351 *~; #X msg 488 421 clear; #X obj 127 160 loadbang; #X obj 131 468 rzero~; #X obj 131 519 czero~; #X obj 156 545 czero~; #X obj 131 497 /~; #X obj 397 257 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 50; #X obj 59 289 *~; #X obj 131 446 /~; #X obj 171 207 samplerate~; #X obj 171 228 / 2; #X obj 127 250 / 22050; #X obj 127 208 f $1; #X obj 127 228 t f b; #X obj 135 181 inlet; #X obj 397 164 loadbang; #X obj 405 185 inlet; #X obj 263 162 loadbang; #X obj 307 209 samplerate~; #X obj 307 230 / 2; #X obj 263 252 / 22050; #X obj 263 230 t f b; #X obj 271 183 inlet; #X obj 58 163 inlet~; #X obj 488 166 inlet; #X obj 155 568 outlet~; #X obj 263 210 f $2; #X obj 397 212 f $3; #X text 58 142 audio; #X text 133 140 lp freq; #X text 263 142 hp freq; #X text 395 146 hi/lo norm; #X text 490 143 clear; #X text 68 10 3-pole , 3-zero butterworth lp/hp/shelving filter. Args: lp freq , hp freq , normalize-hi. Inlets: input signal , lo freq , hi freq , hi norm , reset.; #X text 70 75 For high-pass: set LP freq =0 and hi/lo to 1; #X text 70 56 For low-pass: set HP freq >= SR/2 and hi/lo to 0; #X text 69 92 Shelving: HP and LP specify shelving band. Gain difference is about HP/LP cubed (so HP=2LP should give about 18 dB , for example.) ; #X obj 127 272 buttercoef3; #X obj 198 429 buttercoef3; #X connect 0 0 3 0; #X connect 1 0 2 0; #X connect 1 1 2 1; #X connect 2 0 12 0; #X connect 3 0 1 0; #X connect 4 0 0 0; #X connect 4 0 1 0; #X connect 4 0 2 0; #X connect 4 0 6 0; #X connect 4 0 7 0; #X connect 4 0 8 0; #X connect 5 0 16 0; #X connect 6 0 9 0; #X connect 7 0 8 0; #X connect 7 1 8 1; #X connect 8 0 29 0; #X connect 9 0 7 0; #X connect 10 0 41 1; #X connect 10 0 42 1; #X connect 11 0 0 0; #X connect 12 0 6 0; #X connect 13 0 14 0; #X connect 14 0 15 1; #X connect 15 0 41 0; #X connect 16 0 17 0; #X connect 17 0 15 0; #X connect 17 1 13 0; #X connect 18 0 16 0; #X connect 19 0 31 0; #X connect 20 0 31 0; #X connect 21 0 30 0; #X connect 22 0 23 0; #X connect 23 0 24 1; #X connect 24 0 42 0; #X connect 25 0 24 0; #X connect 25 1 22 0; #X connect 26 0 30 0; #X connect 27 0 11 0; #X connect 28 0 4 0; #X connect 30 0 25 0; #X connect 31 0 10 0; #X connect 41 0 11 1; #X connect 41 1 3 1; #X connect 41 2 0 1; #X connect 41 3 1 2; #X connect 41 3 2 2; #X connect 41 4 1 3; #X connect 41 5 2 3; #X connect 42 0 12 1; #X connect 42 1 9 1; #X connect 42 2 6 1; #X connect 42 3 7 2; #X connect 42 3 8 2; #X connect 42 4 7 3; #X connect 42 5 8 3;
--- NEW FILE: I09.sheep.from.goats.pd --- #N canvas -6 5 609 588 12; #N canvas 300 81 867 775 fft-analysis 0; #X obj 85 664 *~; #X obj 35 712 *~; #X obj 316 148 *~; #X obj 34 58 *~; #X obj 34 35 inlet~; #X obj 34 82 rfft~; #X obj 35 688 rifft~; #X obj 35 737 outlet~; #X obj 277 147 *~; #X obj 277 198 rsqrt~; #X obj 105 421 -~; #X obj 34 663 *~; #X obj 68 58 tabreceive~ $0-hann; #X obj 644 51 loadbang; #X obj 644 133 r window-size; #X obj 69 711 tabreceive~ $0-hann; #X obj 131 327 *~; #X msg 644 155 set $1 4; #X obj 644 179 block~; #X msg 643 75 ; pd dsp 1 ; window-size 1024; #X obj 125 616 /~ 1000; #X obj 197 616 r window-size; #X obj 254 229 *~; #X obj 113 220 *~; #X obj 277 171 +~ 1e-20; #X obj 152 246 lrshift~ 1; #X obj 313 254 lrshift~ 1; #X obj 152 272 lrshift~ -1; #X obj 314 281 lrshift~ -1; #X obj 292 335 *~; #X obj 105 475 clip~ 0 1; #X obj 106 448 *~ 1e+20; #X obj 105 392 +~; #X obj 105 508 *~; #X obj 144 508 lrshift~ 1; #X obj 251 508 lrshift~ -1; #X obj 125 540 *~; #X obj 410 411 -~; #X obj 410 459 clip~ 0 1; #X obj 411 435 *~ 1e+20; #X obj 410 488 *~; #X obj 449 488 lrshift~ 1; #X obj 553 487 lrshift~ -1; #X obj 430 517 *~; #X obj 430 540 *~ -1; #X obj 430 563 +~ 1; #X obj 125 582 +~; #X obj 255 335 *~; #X obj 98 327 *~; #X text 195 476 0 if clean; #X text 170 541 0 if a neighbor is clean; #X obj 97 301 +~; #X obj 130 300 +~; #X obj 255 309 +~; #X obj 292 308 +~; #X text 169 558 1 if all neighbors dirty; #X text 470 584 1 if a neighbor dirty; #X text 472 568 0 if all neighbors clean; #X obj 224 679 lrshift~ -1; #X obj 224 655 sig~ 1; #X obj 125 638 *~; #X obj 220 442 expr $f1*$f1/1250; #X obj 432 385 expr $f1*$f1/1250; #X obj 220 417 r dirty; #X obj 432 360 r clean; #X text 362 148 normalize the amplitudes; #X text 439 253 add neighboring amplitude to this one; #X text 437 269 and take squared magnitude of result -; #X text 437 286 do this for both the left neightbor and; #X text 436 303 the right one; #X text 94 82 forward real Hann-windowed FT; #X text 284 658 I had trouble with the DC bin - this zeros it.; #X text 594 366 adjust threshold to quadratic; #X text 594 382 units and scale; #X text 142 389 total incoherence; #X text 496 414 compare incoherence with the threshold; #X text 532 511 multiply by left and right; #X text 531 529 neighbors , so 0 if any of; #X text 531 546 the 3 is "clean".; #X text 497 429 If greater (dirty) , the "clip" outputs; #X text 498 444 1 , otherwise (if clean) , zero.; #X text 161 583 add to let in channels; #X text 159 597 for either criterion; #X connect 0 0 6 1; #X connect 1 0 7 0; #X connect 2 0 24 0; #X connect 3 0 5 0; #X connect 4 0 3 0; #X connect 5 0 11 0; #X connect 5 0 8 0; #X connect 5 0 8 1; #X connect 5 0 23 0; #X connect 5 1 0 0; #X connect 5 1 2 0; #X connect 5 1 2 1; #X connect 5 1 22 0; #X connect 6 0 1 0; #X connect 8 0 24 0; #X connect 9 0 23 1; #X connect 9 0 22 1; #X connect 10 0 31 0; #X connect 11 0 6 0; #X connect 12 0 3 1; #X connect 13 0 19 0; #X connect 14 0 17 0; #X connect 15 0 1 1; #X connect 16 0 32 0; #X connect 17 0 18 0; #X connect 20 0 60 0; #X connect 21 0 20 1; #X connect 22 0 26 0; #X connect 22 0 28 0; #X connect 22 0 53 0; #X connect 22 0 54 0; #X connect 23 0 25 0; #X connect 23 0 27 0; #X connect 23 0 51 0; #X connect 23 0 52 0; #X connect 24 0 9 0; #X connect 25 0 51 1; #X connect 26 0 53 1; #X connect 27 0 52 1; #X connect 28 0 54 1; #X connect 29 0 32 1; #X connect 30 0 33 0; #X connect 30 0 35 0; #X connect 30 0 34 0; #X connect 31 0 30 0; #X connect 32 0 10 0; #X connect 32 0 37 0; #X connect 33 0 36 0; #X connect 34 0 33 1; #X connect 35 0 36 1; #X connect 36 0 46 0; #X connect 37 0 39 0; #X connect 38 0 40 0; #X connect 38 0 42 0; #X connect 38 0 41 0; #X connect 39 0 38 0; #X connect 40 0 43 0; #X connect 41 0 40 1; #X connect 42 0 43 1; #X connect 43 0 44 0; #X connect 44 0 45 0; #X connect 45 0 46 1; #X connect 46 0 20 0; #X connect 47 0 32 1; #X connect 48 0 32 0; #X connect 51 0 48 0; #X connect 51 0 48 1; #X connect 52 0 16 0; #X connect 52 0 16 1; #X connect 53 0 47 0; #X connect 53 0 47 1; #X connect 54 0 29 0; #X connect 54 0 29 1; #X connect 58 0 60 1; #X connect 59 0 58 0; #X connect 60 0 11 1; #X connect 60 0 0 1; #X connect 61 0 10 1; #X connect 62 0 37 1; #X connect 63 0 61 0; #X connect 64 0 62 0; #X restore 49 410 pd fft-analysis; #X floatatom 355 287 0 0 100 0 - - -; #X text 138 10 PITCHED/UNPITCHED SEPARATION; #X obj 48 443 output~; #X floatatom 48 356 0 0 100 0 - - -; #X text 105 337 noise; #X floatatom 108 356 0 0 100 0 - - -; #N canvas 214 193 769 642 test-signal 0; #X obj 75 328 line~; #X obj 75 250 f; #X obj 517 236 *~; #X obj 76 442 *~; #X obj 517 127 noise~; #X obj 371 494 +~; #X obj 98 415 dbtorms; #X obj 539 210 dbtorms; #X obj 98 390 inlet; #X obj 539 186 inlet; #X obj 373 568 outlet~; #X msg 75 304 0 , $1 $2; #X obj 75 276 pack 0 0; #X obj 236 248 /; #X obj 251 190 * 0.001; #X obj 251 219 t b f; #X obj 372 543 hip~ 5; #X obj 75 136 loadbang; #X obj 75 182 metro 1000; #X obj 517 152 bp~ 10000 3; #X obj 75 161 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X text 270 247 sample duration , msec; #X text 126 84 looped sample playback; #X obj 75 356 tabread4~ $0-sample; #X text 514 100 filtered noise; #X text 105 15 TEST SIGNAL: looped sample plus noise. The inlets control amplitude of each in dB.; #X obj 236 139 r $0-samplength; #X obj 251 164 r $0-insamprate; #X obj 658 244 *~; #X obj 680 218 dbtorms; #X obj 680 194 inlet; #X text 655 108 osc; #X obj 658 134 osc~ 440; #X obj 372 519 *~ 3; #X connect 0 0 23 0; #X connect 1 0 12 0; #X connect 2 0 5 1; #X connect 3 0 5 0; #X connect 4 0 19 0; #X connect 5 0 33 0; #X connect 6 0 3 1; #X connect 7 0 2 1; #X connect 8 0 6 0; #X connect 9 0 7 0; #X connect 11 0 0 0; #X connect 12 0 11 0; #X connect 13 0 12 1; #X connect 13 0 18 1; #X connect 14 0 15 0; #X connect 15 0 13 0; #X connect 15 1 13 1; #X connect 16 0 10 0; #X connect 17 0 20 0; #X connect 18 0 1 0; #X connect 19 0 2 0; #X connect 20 0 18 0; #X connect 23 0 3 0; #X connect 26 0 1 1; #X connect 26 0 13 0; #X connect 27 0 14 0; #X connect 28 0 5 1; #X connect 29 0 28 1; #X connect 30 0 29 0; #X connect 32 0 28 0; #X connect 33 0 16 0; #X restore 48 380 pd test-signal; #X text 32 334 sampler; #X text 56 314 amplitudes (dB); #N canvas 0 110 565 454 hann-window 0; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 1024 float 0; #X coords 0 1 1023 0 300 100 1; #X restore 82 311 graph; #X obj 378 165 osc~; #X obj 378 190 *~ -0.5; #X obj 378 214 +~ 0.5; #X obj 331 247 tabwrite~ $0-hann; #X obj 37 88 r window-size; #X obj 38 173 /; #X obj 127 142 samplerate~; #X obj 38 251 s window-sec; #X obj 177 204 swap; #X obj 177 228 /; #X obj 177 252 s window-hz; #X obj 49 201 * 1000; #X obj 49 228 s window-msec; #X obj 38 115 t f b f; #X msg 173 92 resize $1; #X obj 173 116 s $0-hann; #X obj 330 105 r window-hz; #X msg 382 130 0; #X obj 330 131 t f b; #X text 15 8 calculate Hann window table (variable window size) and constants window-hz (fundamental frequency of analysis) , window-sec and window-msec (analysis window size in seconds and msec).; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 5 0 14 0; #X connect 6 0 8 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 7 0 9 1; #X connect 9 0 10 0; #X connect 9 1 10 1; #X connect 10 0 11 0; #X connect 12 0 13 0; #X connect 14 0 6 0; #X connect 14 0 9 0; #X connect 14 1 7 0; #X connect 14 2 15 0; #X connect 15 0 16 0; #X connect 17 0 19 0; #X connect 18 0 1 1; #X connect 19 0 1 0; #X connect 19 1 4 0; #X connect 19 1 18 0; #X restore 457 458 pd hann-window; #N canvas 52 71 774 520 tables 0; #N canvas 0 0 450 300 graph1 0; #X array $0-last-real 2048 float 0; #X coords 0 500 2048 -500 200 150 1; #X restore 103 15 graph; #N canvas 0 0 450 300 graph2 0; #X array $0-last-imag 2048 float 0; #X coords 0 500 2048 500 200 150 1; #X restore 497 6 graph; #N canvas 0 0 450 300 graph1 0; #X array $0-precess-real 2048 float 0; #X coords 0 500 2048 -500 200 150 1; #X restore 105 185 graph; #N canvas 0 0 450 300 graph2 0; #X array $0-precess-imag 2048 float 0; #X coords 0 500 2048 -500 200 150 1; #X restore 501 178 graph; #N canvas 0 0 450 300 graph1 0; #X array $0-inc-real 2048 float 0; #X coords 0 1 2048 -1 200 150 1; #X restore 105 357 graph; #N canvas 0 0 450 300 graph2 0; #X array $0-inc-imag 2048 float 0; #X coords 0 1 2048 -1 200 150 1; #X restore 503 342 graph; #X restore 457 479 pd tables; #N canvas 388 86 722 350 insample 0; #N canvas 0 0 450 300 graph1 0; #X array $0-sample 62079 float 0; #X coords 0 1 62078 -1 400 150 1; #X restore 259 24 graph; #X obj 19 23 r read-sample; #X obj 19 74 unpack s f; #X obj 19 184 soundfiler; #X text 356 250 read a sample; #X obj 276 249 loadbang; #X obj 19 100 t s b; #X obj 75 99 symbol $0-sample; #X obj 19 135 pack s s; #X msg 19 160 read -resize $1 $2; #X obj 74 46 44100; #X obj 19 47 t a b; #X msg 276 273 ; read-sample ../sound/bell.aiff; #X obj 29 208 s $0-samplength; #X obj 116 74 s $0-insamprate; #X obj 19 247 /; #X obj 19 271 * 1000; #X obj 19 294 s $0-samp-msec; #X obj 57 247 r $0-insamprate; #X connect 1 0 11 0; #X connect 2 0 6 0; #X connect 2 1 14 0; #X connect 3 0 13 0; #X connect 3 0 15 0; #X connect 5 0 12 0; #X connect 6 0 8 0; #X connect 6 1 7 0; #X connect 7 0 8 1; #X connect 8 0 9 0; #X connect 9 0 3 0; #X connect 10 0 14 0; #X connect 11 0 2 0; #X connect 11 1 10 0; #X connect 15 0 16 0; #X connect 16 0 17 0; #X connect 18 0 15 1; #X restore 233 501 pd insample; #X msg 233 403 ../sound/bell.aiff; #X msg 233 426 ../sound/voice.wav; #X msg 233 449 ../sound/voice2.wav; #X text 236 383 change input sound; #X obj 233 473 s read-sample; #X floatatom 233 523 5 0 0 0 - #0-samp-msec -; #X text 286 522 sample length , msec; #X floatatom 233 285 0 0 100 0 - - -; #X floatatom 169 356 0 0 100 0 - - -; #X text 167 336 osc; #X msg 471 325 512; #X msg 471 346 1024; #X msg 471 368 2048; #X obj 471 413 s window-size; #X msg 471 390 4096; #X obj 233 308 s clean; #X text 233 331 0=silent; #X text 231 351 100=all; #X obj 355 310 s dirty; #X text 351 331 100=silent; #X text 353 348 0=all; #X text 354 563 updated for Pd version 0.39; #X text 11 212 Two separate thresholds may be adjusted to listen to the "clean" or "dirty" part of the signal. You'll hear anything less incoherent than the clean threshold , OR more incoherent than the dirty one.; #X text 13 35 This patch applies a very simple coherence test to distinguish between sinusoids and noise in an input signal. It works very imperfectly (since noise is random , no matter what test we place on it it will sometimes spoof its way in.) Here we just test that neighboring channels are 180 degrees (pi radians) out of phase , as they should be in the main lobe in response to a sinusoid. If any three channels are so arranged , all three are considered as contributing to a sinusoid. To do this we make an "incoherence" measure which is zero if the phase relationship is perfect and progressively larger otherwise.; #X connect 0 0 3 0; #X connect 0 0 3 1; #X connect 1 0 31 0; #X connect 4 0 7 0; #X connect 6 0 7 1; #X connect 7 0 0 0; #X connect 13 0 17 0; #X connect 14 0 17 0; #X connect 15 0 17 0; #X connect 20 0 28 0; #X connect 21 0 7 2; #X connect 23 0 26 0; #X connect 24 0 26 0; #X connect 25 0 26 0; #X connect 27 0 26 0;
--- NEW FILE: buttercoef3.pd --- #N canvas 139 346 714 532 10; #X obj 63 51 inlet; #X floatatom 522 134 5 0 0 0 - - -; #X obj 101 153 t f f; #X msg 101 108 0.667; #X msg 82 283 0; #X obj 517 270 loadbang; #X obj 528 298 inlet; #X obj 517 322 f; #X obj 517 346 expr 1 - 2*$f1; #X obj 63 79 t b b b f; #X obj 205 228 * -1; #X obj 163 228 t f f; #X obj 63 391 f; #X obj 30 463 outlet; #X text 515 237 1 to normalize at Nyquist; #X text 59 30 characteristic frequency , 0(DC) to 1(Nyquist); #X obj 283 470 outlet; #X obj 439 472 outlet; #X text 439 494 imag2a; #X text 283 492 real1; #X text 374 494 real2; #X obj 500 473 outlet; #X text 500 495 imag2b; #X obj 373 470 outlet; #X text 27 485 normalizer1; #X obj 173 470 outlet; #X text 170 492 normalizer2; #X obj 156 436 expr (($f2-$f1)*($f2-$f1)+$f3*$f3); #X obj 63 412 t f f; #X obj 101 176 expr (1 - $f2*$f2) / (1 + $f2*$f2 + 2*$f2*cos($f1)) ; #X obj 163 205 expr 2*$f2*sin($f1) / (1 + $f2*$f2 + 2*$f2*cos($f1)) ; #X obj 82 307 expr (1 - $f2*$f2) / (1 + $f2*$f2 + 2*$f2*cos($f1)); #X obj 522 89 clip 0 1; #X obj 522 111 expr tan($f1*1.57); #X obj 101 131 expr $f1*1.5708; #X text 515 251 0 to normalize at DC; #X text 119 4 3-pole (or zero) Butterworth filter coefficient calculator ; #X text 145 109 "theta" in units of pi/2; #X text 211 138 conjugate pair of pole/zero locations:; #X text 197 155 real part: (1-r*r)/(1+r*r-2rcos(th)); #X text 245 226 imaginary part: 2rsin(th)/(...); #X text 270 282 real-valued one , theta=0; #X obj 30 439 expr abs($f1-$f2); #X connect 0 0 9 0; #X connect 1 0 29 1; #X connect 1 0 30 1; #X connect 1 0 31 1; #X connect 2 0 29 0; #X connect 2 1 30 0; #X connect 3 0 34 0; #X connect 4 0 31 0; #X connect 5 0 7 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 8 0 12 1; #X connect 9 0 12 0; #X connect 9 1 4 0; #X connect 9 2 3 0; #X connect 9 3 32 0; #X connect 10 0 21 0; #X connect 11 0 17 0; #X connect 11 0 27 2; #X connect 11 1 10 0; #X connect 12 0 28 0; #X connect 27 0 25 0; #X connect 28 0 42 0; #X connect 28 1 27 0; #X connect 29 0 23 0; #X connect 29 0 27 1; #X connect 30 0 11 0; #X connect 31 0 16 0; #X connect 31 0 42 1; #X connect 32 0 33 0; #X connect 33 0 1 0; #X connect 34 0 2 0; #X connect 42 0 13 0;
--- NEW FILE: I04.noisegate.pd --- #N canvas 42 28 657 564 12; #X floatatom 316 376 0 0 0 0 - - -; #X floatatom 81 384 0 0 100 0 - - -; #N canvas 98 0 648 669 fft-analysis 0; #X obj 35 589 *~; #X obj 143 305 *~; #X obj 158 150 *~; #X obj 35 72 *~; #X obj 76 527 *~; #X obj 35 44 inlet~; #X obj 35 528 *~; #X obj 34 101 rfft~; #X obj 35 558 rifft~; #X obj 36 616 outlet~; #X obj 119 149 *~; #X obj 119 176 +~; #X obj 165 278 r mask-level; #X obj 100 422 /~; #X obj 355 23 block~ 1024 4; #X text 176 446 is signal power and "m" is mask.; #X obj 131 332 -~; #X obj 131 355 max~ 0; #X obj 99 448 q8_sqrt~; #X text 175 464 (zero if s < m).; #X obj 144 256 tabreceive~ $0-mask; #X obj 76 72 tabreceive~ $0-hann; #X obj 69 590 tabreceive~ $0-hann; #N canvas 91 250 910 495 calculate-mask 0; #X obj 125 379 inlet~; #X msg 371 283 0; #X msg 371 166 0; #X obj 240 196 float; #X obj 294 200 + 1; #X obj 240 144 bang~; #X obj 240 169 spigot; #X floatatom 411 218 0 0 0 0 - - -; #X obj 315 408 -~; #X obj 371 258 sel 0; #X obj 327 443 *~; #X obj 293 443 +~; #X floatatom 351 313 0 0 0 0 - - -; #X obj 240 219 t f f; #X obj 370 113 r make-mask; #X obj 371 141 t b f; #X obj 411 165 /; #X text 483 212 number of; #X text 491 227 frames; #X floatatom 481 166 0 0 0 0 - - -; #X obj 480 113 r window-msec; #X obj 481 136 / 4; #X text 521 133 hop size (analysis; #X text 546 149 period) in msec; #X obj 359 408 tabreceive~ $0-mask; #X obj 292 468 tabsend~ $0-mask; #X obj 371 218 <; #X obj 235 258 expr 1/($f1+1); #X text 134 17 calculate a mask using N msec of background noise; #X text 43 354 current power (for each channel); #X text 367 430 average the current power into the last mask to get the new mask. The new value is weighted 1/n on the nth iteration.; #X text 390 312 weight to average in new power to mask; #X text 11 203 loop counting to desired; #X text 78 219 number of frames; #X text 72 39 This loops for "make-mask" milliseconds , averaging power in each channel over that amount of time. This is done by a moving average whose weight is adjusted to average each new value equally with each of the accumulating ones.; #X connect 0 0 8 0; #X connect 1 0 12 0; #X connect 2 0 3 1; #X connect 2 0 26 0; #X connect 3 0 13 0; #X connect 3 0 4 0; #X connect 4 0 3 1; #X connect 5 0 6 0; #X connect 6 0 3 0; #X connect 7 0 26 1; #X connect 8 0 10 0; #X connect 9 0 1 0; #X connect 10 0 11 1; #X connect 11 0 25 0; #X connect 12 0 10 1; #X connect 13 0 26 0; #X connect 13 1 27 0; #X connect 14 0 15 0; #X connect 15 0 2 0; #X connect 15 1 16 0; #X connect 16 0 7 0; #X connect 20 0 21 0; #X connect 21 0 16 1; #X connect 21 0 19 0; #X connect 24 0 8 1; #X connect 24 0 11 0; #X connect 26 0 6 1; #X connect 26 0 9 0; #X connect 27 0 12 0; #X restore 132 203 pd calculate-mask; #X text 91 98 real Fourier transform; #X obj 357 57 loadbang; #X msg 357 80 ; pd dsp 1 ; window-size 1024; #X text 193 355 ... but not less than zero; #X text 101 561 real inverse Fourier transform; #X text 196 498 normalize by 2/(3N) where N is window size; #X text 168 332 current power ("s") minus level-adjusted mask ("m") ; #X text 156 175 compute power (call it "s") in each channel; #X obj 123 395 +~ 1e-20; #X text 203 395 protect against division by zero; #X text 179 426 compute sqrt((s-m)/s) where "s"; #X text 296 204 <- subwindow calculates noise mask; #X obj 98 499 /~ 1536; #X connect 0 0 9 0; #X connect 1 0 16 1; #X connect 2 0 11 1; #X connect 3 0 7 0; #X connect 4 0 8 1; #X connect 5 0 3 0; #X connect 6 0 8 0; #X connect 7 0 6 0; #X connect 7 0 10 0; #X connect 7 0 10 1; #X connect 7 1 4 0; #X connect 7 1 2 0; #X connect 7 1 2 1; #X connect 8 0 0 0; #X connect 10 0 11 0; #X connect 11 0 16 0; #X connect 11 0 23 0; #X connect 11 0 32 0; #X connect 12 0 1 1; #X connect 13 0 18 0; #X connect 16 0 17 0; #X connect 17 0 13 0; #X connect 18 0 36 0; #X connect 20 0 1 0; #X connect 21 0 3 1; #X connect 22 0 0 1; #X connect 25 0 26 0; #X connect 32 0 13 1; #X connect 36 0 6 1; #X connect 36 0 4 1; #X restore 80 441 pd fft-analysis; #N canvas 0 110 565 454 hann-window 0; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 1024 float 0; #X coords 0 1 1023 0 300 100 1; #X restore 82 311 graph; #X obj 378 165 osc~; #X obj 378 190 *~ -0.5; #X obj 378 214 +~ 0.5; #X obj 331 247 tabwrite~ $0-hann; #X obj 37 88 r window-size; #X obj 38 173 /; #X obj 127 142 samplerate~; #X obj 38 251 s window-sec; #X obj 177 204 swap; #X obj 177 228 /; #X obj 177 252 s window-hz; #X obj 49 201 * 1000; #X obj 49 228 s window-msec; #X obj 38 115 t f b f; #X msg 173 92 resize $1; #X obj 173 116 s $0-hann; #X obj 330 105 r window-hz; #X msg 382 130 0; #X obj 330 131 t f b; #X text 15 8 calculate Hann window table (variable window size) and constants window-hz (fundamental frequency of analysis) , window-sec and window-msec (analysis window size in seconds and msec).; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 5 0 14 0; #X connect 6 0 8 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 7 0 9 1; #X connect 9 0 10 0; #X connect 9 1 10 1; #X connect 10 0 11 0; #X connect 12 0 13 0; #X connect 14 0 6 0; #X connect 14 0 9 0; #X connect 14 1 7 0; #X connect 14 2 15 0; #X connect 15 0 16 0; #X connect 17 0 19 0; #X connect 18 0 1 1; #X connect 19 0 1 0; #X connect 19 1 4 0; #X connect 19 1 18 0; #X restore 331 478 pd hann-window; #X text 197 355 noise; #N canvas 132 255 660 373 insample 0; #N canvas 0 0 450 300 graph1 0; #X array $0-sample 155948 float 0; #X coords 0 1 155947 -1 400 150 1; #X restore 236 25 graph; #X obj 19 23 r read-sample; #X obj 19 74 unpack s f; #X obj 116 74 s insamprate; #X obj 19 184 soundfiler; #X obj 19 208 s insamplength; #X text 113 252 read a sample; #X obj 33 251 loadbang; #X obj 19 100 t s b; #X obj 75 99 symbol $0-sample; #X obj 19 135 pack s s; #X msg 19 160 read -resize $1 $2; #X obj 74 46 44100; #X msg 33 275 ; read-sample ../sound/bell.aiff; #X msg 31 322 ; read-sample ../sound/voice.wav; #X obj 19 47 t a b; #X connect 1 0 15 0; #X connect 2 0 8 0; #X connect 2 1 3 0; #X connect 4 0 5 0; #X connect 7 0 13 0; #X connect 8 0 10 0; #X connect 8 1 9 0; #X connect 9 0 10 1; #X connect 10 0 11 0; #X connect 11 0 4 0; #X connect 12 0 3 0; #X connect 15 0 2 0; #X connect 15 1 12 0; #X restore 331 456 pd insample; #X obj 316 401 s mask-level; #X floatatom 202 379 0 0 100 0 - - -; #X text 317 325 on; #X text 362 326 off; #X text 317 309 masking; #X text 290 5 DENOISER; #X msg 361 349 0; #N canvas 190 43 812 571 test-signal 0; #X obj 75 328 line~; #X obj 75 250 f; #X obj 251 164 r insamprate; #X obj 583 219 *~; #X obj 76 442 *~; #X obj 583 110 noise~; #X obj 370 493 +~; #X obj 98 415 dbtorms; #X obj 605 193 dbtorms; #X obj 98 390 inlet; #X obj 605 169 inlet; #X obj 371 541 outlet~; #X obj 236 139 r insamplength; #X msg 75 304 0 , $1 $2; #X obj 75 276 pack 0 0; #X obj 236 248 /; #X obj 251 190 * 0.001; #X obj 251 219 t b f; #X obj 370 516 hip~ 5; #X obj 75 136 loadbang; #X obj 75 182 metro 1000; #X obj 583 135 bp~ 10000 3; #X obj 75 161 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X text 270 247 sample duration , msec; #X text 126 84 looped sample playback; #X obj 75 356 tabread4~ $0-sample; #X text 580 83 filtered noise; #X text 105 15 TEST SIGNAL: looped sample plus noise. The inlets control amplitude of each in dB.; #X connect 0 0 25 0; #X connect 1 0 14 0; #X connect 2 0 16 0; #X connect 3 0 6 1; #X connect 4 0 6 0; #X connect 5 0 21 0; #X connect 6 0 18 0; #X connect 7 0 4 1; #X connect 8 0 3 1; #X connect 9 0 7 0; #X connect 10 0 8 0; #X connect 12 0 1 1; #X connect 12 0 15 0; #X connect 13 0 0 0; #X connect 14 0 13 0; #X connect 15 0 14 1; #X connect 15 0 20 1; #X connect 16 0 17 0; #X connect 17 0 15 0; #X connect 17 1 15 1; #X connect 18 0 11 0; #X connect 19 0 22 0; #X connect 20 0 1 0; #X connect 21 0 3 0; #X connect 22 0 20 0; #X connect 25 0 4 0; #X restore 81 409 pd test-signal; #X text 69 357 sampler; #X text 443 311 calculate noise mask; #X obj 80 488 output~; #X msg 462 338 ; make-mask 2000; #X msg 316 348 15; #N canvas 0 0 592 442 mask-table 0; #N canvas 0 0 450 300 graph1 0; #X array $0-mask 512 float 0; #X coords 0 500 511 0 400 300 1; #X restore 110 76 graph; #X text 25 14 This table ($0-mask) is the average power measured in each channel of the spectrum , presumed to represent the noise floor. ; #X restore 331 500 pd mask-table; #X text 80 322 amplitudes (dB); #X text 68 26 This patch attempts to scrub the noise floor from a sample in two steps. First using the "make-mask" message (which is caught in the "fft-analysis" window) , you estimate the background spectrum. You would normally do this at a moment when only the background noise is audible. Then , turn on "masking" (to 15 by default , but try other values) and the patch will try to clean the background noise out of a signal.; #X text 67 149 For this demonstration , you control the amplitudes of a looping sample and a filtered noise source. Normally you'd hit "calculate noise mask" with only hte noise turned on , then turn both the noise and the sampler on , and also "masking" , to see if the patch can clean the noise out of the signal. Open the "fft-analysis" window to see the algorithm , or the "insample" window to change samples , or "mask-table" to see the current mask (the average signal power of the noise to clean out of the signal).; #X connect 0 0 6 0; #X connect 1 0 13 0; #X connect 2 0 16 0; #X connect 2 0 16 1; #X connect 7 0 13 1; #X connect 12 0 0 0; #X connect 13 0 2 0; #X connect 18 0 0 0;
--- NEW FILE: I02.Hann.window.pd --- #N canvas 281 223 567 589 12; #N canvas 228 148 651 544 fft-analysis 0; #X obj 15 164 *~; #X obj 14 99 inlet~; #X obj 15 218 rfft~; #X obj 36 140 tabreceive~ $0-hann; #X obj 14 306 *~; #X obj 56 306 *~; #X obj 15 356 sqrt~; #X obj 14 498 tabwrite~ $0-magnitude; #X obj 23 386 loadbang; #X obj 23 470 metro 250; #X obj 23 449 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X msg 31 411 ; pd dsp 1; #X obj 15 8 block~ 512; #X text 225 131 tabreceive~ outputs array contents ,; #X text 225 149 constantly , every block. Here it's; #X text 223 169 used to get the Hann window to; #X text 225 187 multiply by the input.; #X text 120 7 block~ object does no computation but declares this; #X text 120 24 window to be operating at a different block size from ; #X text 122 58 Fourier transform.; #X text 121 40 the parent window. This determines the size of the; #X text 76 99 The inlet~ automatically re-blocks to the new block size. ; #X obj 15 332 +~; #X text 94 308 Take the magnitude by squaring real and imaginary part , adding and taking square root.; #X text 110 424 periodically graph the output. It appears every 512 samples (about 12 milliseconds) but we only update the graph 4 times per second. The graph is back on the main (parent) window.; #X text 82 215 forward real FFT. Like "fft~" , but only one inlet (for the real part) and only the first half of the output signals are used. (The others are determined by symmetry: they're complex conjugates of the first half , in reverse order.) This takes 1/2 the CPU time of "fft".; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 2 0 4 0; #X connect 2 0 4 1; #X connect 2 1 5 0; #X connect 2 1 5 1; #X connect 3 0 0 1; #X connect 4 0 22 0; #X connect 5 0 22 1; #X connect 6 0 7 0; #X connect 8 0 10 0; #X connect 8 0 11 0; #X connect 9 0 7 0; #X connect 10 0 9 0; #X connect 22 0 6 0; #X restore 26 289 pd fft-analysis; #N canvas 0 0 450 300 graph1 0; #X array $0-magnitude 256 float 0; #X coords 0 256 255 0 256 100 1; #X restore 287 208 graph; #X text 110 6 WINDOWING AND BLOCKING FOURIER TRANSFORMS; #X obj 25 264 osc~; #X floatatom 25 218 5 0 0 0 - - -; #X obj 25 240 * 10; #X text 305 559 updated for Pd version 0.39; #X text 349 183 magnitude; #X text 284 311 0; #X text 522 311 255; #X text 273 297 0; #X text 255 253 128; #X text 254 203 256; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 512 float 1; #A 0 0 3.76403e-05 0.000150591 0.000338793 0.000602275 0.000940949 0.00135478 0.00184369 0.00240764 0.00304651 0.00376022 0.00454867 0.00541174 0.0063493 0.00736117 0.00844723 0.00960734 0.0108413 0.0121489 0.01353 0.0149843 0.0165117 0.0181119 0.0197847 0.0215298 0.0233469 0.0252359 0.0271963 0.0292279 0.0313304 0.0335035 0.0357469 0.0380601 0.040443 0.042895 0.0454159 0.0480052 0.0506626 0.0533877 0.05618 0.0590392 0.0619648 0.0649563 0.0680134 0.0711355 0.0743222 0.077573 0.0808874 0.0842649 0.0877051 0.0912073 0.0947711 0.0983959 0.102081 0.105826 0.109631 0.113494 0.117416 0.121395 0.125431 0.129524 0.133672 0.137876 0.142134 0.146446 0.150811 0.155229 0.159699 0.16422 0.168792 0.173413 0.178084 0.182803 0.18757 0.192384 0.197244 0.20215 0.2071 0.212095 0.217133 0.222214 0.227337 0.2325 0.237704 0.242948 0.24823 0.25355 0.258907 0.264301 0.26973 0.275194 0.280691 0.286222 0.291785 0.297379 0.303003 0.308658 0.314341 0.320052 0.32579 0.331555 0.337344 0.343159 0.348997 0.354857 0.36074 0.366643 0.372567 0.37851 0.384471 0.390449 0.396444 0.402454 0.40848 0.414519 0.420571 0.426634 0.432709 0.438794 0.444889 0.450991 0.457101 0.463218 0.469339 0.475466 0.481596 0.487729 0.493864 0.5 0.506136 0.512271 0.518404 0.524534 0.53066 0.536782 0.542899 0.549009 0.555111 0.561205 0.56729 0.573365 0.579429 0.585481 0.59152 0.597545 0.603556 0.609551 0.615529 0.62149 0.627433 0.633357 0.63926 0.645143 0.651003 0.656841 0.662656 0.668445 0.67421 0.679948 0.685659 0.691342 0.696997 0.702621 0.708215 0.713778 0.719309 0.724806 0.73027 0.735699 0.741092 0.74645 0.75177 0.757052 0.762295 0.767499 0.772663 0.777786 0.782867 0.787905 0.7929 0.79785 0.802756 0.807616 0.81243 0.817197 0.821916 0.826587 0.831209 0.83578 0.840301 0.844771 0.849189 0.853554 0.857866 0.862124 0.866328 0.870476 0.874569 0.878605 0.882584 0.886506 0.890369 0.894174 0.897919 0.901605 0.905229 0.908793 0.912295 0.915736 0.919113 0.922428 0.925678 0.928865 0.931987 0.935044 0.938036 0.940961 0.94382 0.946613 0.949338 0.951995 0.954585 0.957106 0.959558 0.96194 0.964254 0.966497 0.96867 0.970773 0.972804 0.974765 0.976654 0.978471 0.980216 0.981889 0.983489 0.985016 0.98647 0.987852 0.989159 0.990393 0.991553 0.992639 0.993651 0.994589 0.995452 0.99624 0.996954 0.997593 0.998156 0.998645 0.999059 0.999398 0.999661 0.999849 0.999962 1 0.999962 0.999849 0.999661 0.999398 0.999059 0.998645 0.998156 0.997592 0.996953 0.996239 0.995451 0.994588 0.99365 0.992638 0.991552 0.990392 0.989158 0.987851 0.986469 0.985015 0.983488 0.981887 0.980215 0.978469 0.976652 0.974763 0.972803 0.970771 0.968669 0.966495 0.964252 0.961939 0.959556 0.957104 0.954583 0.951993 0.949336 0.946611 0.943819 0.940959 0.938034 0.935042 0.931985 0.928863 0.925676 0.922425 0.919111 0.915733 0.912293 0.908791 0.905227 0.901602 0.897917 0.894171 0.890367 0.886503 0.882582 0.878602 0.874566 0.870473 0.866325 0.862121 0.857863 0.853551 0.849186 0.844768 0.840298 0.835777 0.831205 0.826584 0.821913 0.817194 0.812427 0.807613 0.802753 0.797847 0.792896 0.787901 0.782863 0.777782 0.77266 0.767496 0.762292 0.757048 0.751766 0.746446 0.741089 0.735695 0.730266 0.724802 0.719305 0.713774 0.708211 0.702617 0.696993 0.691338 0.685655 0.679944 0.674206 0.668441 0.662652 0.656837 0.650999 0.645139 0.639256 0.633353 0.627429 0.621486 0.615525 0.609547 0.603552 0.597541 0.591516 0.585477 0.579425 0.573361 0.567286 0.561201 0.555107 0.549004 0.542895 0.536778 0.530656 0.52453 0.518399 0.512266 0.506132 0.499996 0.49386 0.487725 0.481592 0.475462 0.469335 0.463213 0.457097 0.450987 0.444885 0.43879 0.432705 0.42663 0.420566 0.414515 0.408476 0.40245 0.39644 0.390445 0.384466 0.378505 0.372563 0.366639 0.360736 0.354853 0.348993 0.343155 0.33734 0.331551 0.325786 0.320048 0.314337 0.308654 0.303 0.297375 0.291781 0.286218 0.280687 0.27519 0.269726 0.264297 0.258904 0.253547 0.248226 0.242944 0.237701 0.232497 0.227333 0.222211 0.21713 0.212092 0.207097 0.202146 0.19724 0.19238 0.187566 0.182799 0.17808 0.17341 0.168788 0.164217 0.159696 0.155226 0.150808 0.146443 0.142131 0.137873 0.133669 0.129521 0.125428 0.121392 0.117413 0.113491 0.109628 0.105823 0.102078 0.0983929 0.0947681 0.0912044 0.0877022 0.0842621 0.0808846 0.0775702 0.0743194 0.0711327 0.0680107 0.0649537 0.0619622 0.0590366 0.0561775 0.0533853 0.0506602 0.0480029 0.0454136 0.0428928 0.0404408 0.038058 0.0357448 0.0335015 0.0313284 0.029226 0.0271944 0.025234 0.0233452 0.0215281 0.019783 0.0181104 0.0165102 0.0149829 0.0135286 0.0121476 0.01084 0.00960615 0.0084461 0.0073601 0.00634828 0.00541082 0.00454783 0.00375944 0.00304583 0.00240701 0.00184315 0.00135431 0.000940561 0.000601947 0.000338584 0.000150442 3.75807e-05 ; #X coords 0 1 511 0 200 120 1; #X restore 278 401 graph; #X msg 156 415 0; #X obj 50 464 osc~; #X obj 50 416 samplerate~; #X obj 50 487 *~ -0.5; #X obj 50 510 +~ 0.5; #X obj 42 535 tabwrite~ $0-hann; #X text 264 393 1; #X text 257 511 0; #X text 273 524 0; #X obj 50 440 / 512; #X obj 42 393 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 321 373 Hann window; #X text 98 462 period 512; #X text 40 368 recalculate Hann; #X text 75 383 window table; #X text 100 233 tens of Hz.; #X text 80 215 <- frequency ,; #X text 98 270 click here and; #X text 170 286 <- see; #X text 21 32 In this example we use a sub-patch ("pd fft-analysis") to re-block the Fourier transform to 512 points. The signal is multiplied by the Hann window function (which is just a raised cosine.) The magnitude , which is computed in the sub-patch , is graphed below in this window. The point at 255 corresponds to just below the Nyquist frequency. Phase isn't shown , and unlike the previous patch we don't control the initial phase of the oscillator. (For fun , try drawing other window functions with the mouse...); #X text 459 527 511; #X connect 3 0 0 0; #X connect 4 0 5 0; #X connect 5 0 3 0; #X connect 14 0 15 1; #X connect 15 0 17 0; #X connect 16 0 23 0; #X connect 17 0 18 0; #X connect 18 0 19 0; #X connect 23 0 15 0; #X connect 24 0 16 0; #X connect 24 0 14 0; #X connect 24 0 19 0;
--- NEW FILE: H03.band-pass.pd --- #N canvas 44 0 604 533 12; #X obj 43 278 mtof; #X floatatom 43 255 5 0 150 0 - #0-pit -; #X obj 32 446 output~; #X obj 32 225 noise~; #X text 95 254 <-- cutoff (pitch units); #X text 106 301 <-- cutoff (Hertz); #X floatatom 43 303 5 0 0 0 - - -; #X text 330 494 updated for Pd version 0.39; #X obj 121 414 metro 250; #X obj 121 394 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 139 391 graphing on/off; #N canvas 0 0 450 300 graph2 0; #X array H03-graph 882 float 2; #X coords 0 1 882 -1 200 140 1; #X restore 375 290 graph; #X text 399 432 --- 0.02 sec ---; #X text 98 224 white noise , test signal; #X obj 32 361 bp~; #X text 73 363 band-pass filter; #X obj 121 439 tabwrite~ H03-graph; #X floatatom 54 331 5 0 1000 0 - #0-q -; #X text 106 329 <-- q; #N canvas 0 0 450 300 loadbang 0; #X obj 85 16 loadbang; #X obj 85 40 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 85 59 f $0; #X text 18 179 boxes.; #X text 16 161 This subpatch loads initial values in number; #X msg 85 83 ; $1-pit 72 ; $1-q 1; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 139 482 pd loadbang; #X text 154 8 RESONANT (BAND-PASS) FILTER; #X text 26 129 The two controls specify , first , the center frequency , and second , the sharpness of the filter , commonly called "q". If you increase q to 10 or 20 , you will see a drop in total signal power , and moreover , you'll see and hear the resonant frequency more clearly in the result.; #X text 28 30 A simple resonant band-pass filter is provided in the bp~ object. Resonant filters can be tuned to a specific "center frequency" and then will pass that frequency while attenuating other frequencies (the further from the center frequency , the more attenuation). This patch uses a white noise source to demonstrate bp~.; #X connect 0 0 6 0; #X connect 1 0 0 0; #X connect 3 0 14 0; #X connect 6 0 14 1; #X connect 8 0 16 0; #X connect 9 0 8 0; #X connect 14 0 2 0; #X connect 14 0 2 1; #X connect 14 0 16 0; #X connect 17 0 14 2;
--- NEW FILE: H10.measurement.pd --- #N canvas 25 22 868 421 12; #X obj 25 338 filter-graph2 tab1 tab2; #N canvas 0 0 450 300 graph2 0; #X array tab1 100 float 1; #A 0 0.830737 0.844715 0.882793 0.953057 1.0592 1.19383 1.30927 1.28362 1.08532 0.848171 0.656605 0.517756 0.418204 0.345252 0.291106 0.249389 0.216703 0.190566 0.169369 0.1519 0.137418 0.12526 0.114871 0.105957 0.0982917 0.0916027 0.0857987 0.0806894 0.076187 0.0722001 0.0686727 0.0655318 0.0627325 0.060178 0.0580025 0.056008 0.0542273 0.0526222 0.0511875 0.0499289 0.0488555 0.0478795 0.0470241 0.0462859 0.0456642 0.0451251 0.0447277 0.0444219 0.0442324 0.0443406 0.0449216 0.0393798 0.0442362 0.0444218 0.0447274 0.0451473 0.0456706 0.0462777 0.0470196 0.0478395 0.0488555 0.0499664 0.0512245 0.0526221 0.05419 0.0559661 0.0580025 0.0602342 0.0627325 0.0655169 0.0686727 0.0722052 0.076187 0.0806893 0.085799 0.0916177 0.0982915 0.10592 0.11479 0.12526 0.137483 0.151997 0.169411 0.190532 0.216594 0.24918 0.291106 0.345511 0.418206 0.517664 0.656606 0.848216 1.08532 1.28264 1.30927 1.19534 1.05919 0.951738 0.882758 0.851605; #X coords 0 2 99 0 200 140 1; #X restore 634 -1 graph; #N canvas 0 0 450 300 graph2 0; #X array tab2 100 float 3; #A 0 8.59501e-06 0.0327982 0.0790568 0.143062 0.250239 0.425263 0.697661 1.04745 1.37257 1.59826 1.73194 1.8042 1.83798 1.84726 1.84029 1.8221 1.79589 1.76375 1.72711 1.68696 1.64405 1.5989 1.55192 1.50343 1.45366 1.40283 1.35108 1.29854 1.24532 1.19151 1.13718 1.0824 1.02722 0.971679 0.915831 0.859703 0.803332 0.746743 0.689957 0.633001 0.57589 0.518653 0.461293 0.403871 0.346275 0.288763 0.230985 0.173676 0.11652 0.0674726 -0.000119478 6.21552 6.16648 6.10932 6.05201 5.99424 5.93673 5.87913 5.82171 5.76435 5.70711 5.65 5.59304 5.53626 5.47967 5.4233 5.36717 5.31132 5.25578 5.2006 5.14582 5.09149 5.03768 4.98446 4.93192 4.88017 4.82934 4.77958 4.73108 4.6841 4.63895 4.59604 4.55589 4.51925 4.48711 4.4609 4.44271 4.43574 4.44501 4.4788 4.55106 4.68474 4.91043 5.23555 5.58534 5.85774 6.03276 6.13994 6.20394 6.24278; #X coords 0 6.283 99 0 200 140 1; #X restore 639 200 graph; #X text 621 56 1; #X text 633 342 0; #X text 615 265 pi; #X text 608 195 2pi; #X obj 25 203 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 33 249 5 0 0 0 - - -; #X text 621 -8 2; #X text 104 -6 MEASURING FILTER FREQUENCY AND PHASE RESPONSE; #X text 610 382 updated for Pd version 0.39; #X text 691 145 frequency; #X text 631 141 0; #X text 814 144 44100; #N canvas 876 177 375 255 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X msg 22 91 ; $1-freq 3000 ; $1-q 3; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 285 350 pd startup; #X floatatom 238 257 5 0 10000 0 - #0-freq -; #X floatatom 249 280 3 0 999 0 - #0-q -; #X text 12 18 You can use the "filter-graph1" and "filter-graph2" abstractions as shown to test filters. Connect them as shown with a filter between them. Try varying the parameters and/or substituting other filters. ; #X text 575 127 gain=0; #X text 574 327 phase=0; #X obj 25 226 filter-graph1 100 44100; #X obj 227 310 bp~; #X text 44 202 <-- compute; #X text 34 266 index; #X text 290 254 <-- center frequency; #X text 288 279 <-- "Q"; #X text 9 86 "filter-graph1" takes as arguments the number of points to graph and the frequency range. "filter-graph2 takes as arguments the name of a table to hold the (frequency dependent) gain , and another , if specified , for the phase.; #X text 8 153 You can edit this patch to replace "bp" with any other filter you're curious about.; #X connect 7 0 21 0; #X connect 16 0 22 1; #X connect 17 0 22 2; #X connect 21 0 0 0; #X connect 21 0 8 0; #X connect 21 1 0 1; #X connect 21 1 22 0; #X connect 21 2 0 2; #X connect 22 0 0 3;
--- NEW FILE: J07.oversampling.pd --- #N canvas 343 48 578 498 12; #N canvas 158 4 728 420 16x 0; #X obj 21 151 *~ 0.064; #X obj 21 174 rpole~ 0.93538; #X obj 21 197 *~ 0.00431; #X obj 21 220 cpole~ 0.96559 0.05592; #X obj 21 246 cpole~ 0.96559 -0.05592; #X obj 21 269 *~ 0.125; #X obj 21 292 rzero~ -1; #X obj 21 315 rzero~ -1; #X obj 21 338 rzero~ -1; #X obj 21 66 phasor~; #X obj 204 29 block~ 1024 1 16; #X obj 21 31 inlet; #X obj 21 372 outlet~; #X text 170 151 These objects make a 3-pole , 3-zero Butterwirth low-pass filter with cutoff at 15kHz (assuming 44100 sample rate.) The filter was designed using the "buttercoef3" abstraction introduced in patch H13.butterworth.pd in this series.; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 1 4 1; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 8 0 12 0; #X connect 9 0 0 0; #X connect 11 0 9 0; #X restore 23 148 pd 16x; #X floatatom 23 111 7 0 0 0 - - -; #X obj 109 149 phasor~; #X obj 22 194 output~; #X obj 108 194 output~; #X obj 23 83 mtof; #X floatatom 23 59 3 -24 135 0 - - -; #X text 131 18 UPSAMPLING TO CONTROL FOLDOVER; #X text 56 57 <-- pitch; #X text 126 250 not; #X text 22 265 sampled; #X text 26 249 16x up-; #X text 20 293 The "pd 16x" subpatch at left contains a phasor~ object , but is locally upsampled by a factor of sixteen. Without upsampling , partials as low as 24 Khz. fold back over into the audible range. With upsampling , the first audibly folding over partial is at almost 700 Hz , 29 times higher. The relevant partials will be 29 times , or almost 30 dB , quieter when upsampled.; #X text 21 403 A third-order Butterworth filter is used inside the "pd 16x" subpatch - without that , the internal signal would fold over as it gets downsampled at the outlet~ object.; #X text 324 464 Updated for Pd version 0.39; #X connect 0 0 3 0; #X connect 0 0 3 1; #X connect 1 0 0 0; #X connect 1 0 2 0; #X connect 2 0 4 0; #X connect 2 0 4 1; #X connect 5 0 1 0; #X connect 6 0 5 0;
--- NEW FILE: I08.pvoc.reverb.pd --- #N canvas 502 83 570 415 12; #N canvas 105 328 986 609 fft 0; #X obj 18 500 *~; #X obj 291 455 *~; #X obj 258 454 *~; #X obj 356 456 *~; #X obj 324 455 *~; #X obj 324 477 +~; #X obj 258 479 -~; #X obj 560 383 *~; #X obj 54 124 *~; #X obj 22 124 *~; #X obj 22 145 +~; #X obj 325 82 *~; #X obj 293 82 *~; #X obj 608 312 *~; #X obj 576 312 *~; #X obj 93 63 *~; #X obj 18 522 outlet~; #X obj 18 475 *~; #X obj 126 63 inlet~; #X obj 93 84 rfft~; #X obj 18 451 rifft~; #X obj 576 334 rsqrt~; #X obj 293 103 +~; #X obj 484 383 *~; #X obj 56 499 sig~ 0.0002; #N canvas 167 161 699 396 decision 0; #X obj 49 101 inlet~; #X obj 50 341 outlet~; #X obj 50 183 -~; #X obj 50 226 clip~ 0 1; #X obj 50 204 *~ 1e+20; #X obj 196 98 inlet~; #X text 137 213 stronger than; #X text 139 228 old one; #X obj 274 202 -~; #X obj 288 177 lrshift~ 1; #X obj 274 250 clip~ 0 1; #X obj 274 228 *~ 1e+20; #X obj 450 202 -~; #X obj 450 250 clip~ 0 1; #X obj 450 228 *~ 1e+20; #X obj 464 177 lrshift~ -1; #X obj 50 283 *~; #X obj 50 312 *~; #X text 135 199 1 if new signal; #X text 55 73 new; #X text 203 70 old; #X text 51 12 Choose whether to replace the "lod" signal with the "new" one. The "new" one must be stronger than the old one and also must be stronger than its two neighboring channels; #X text 267 283 1 if we're louder than neighbor; #X connect 0 0 2 0; #X connect 0 0 9 0; #X connect 0 0 8 0; #X connect 0 0 12 0; #X connect 0 0 15 0; #X connect 2 0 4 0; #X connect 3 0 16 0; #X connect 4 0 3 0; #X connect 5 0 2 1; #X connect 8 0 11 0; #X connect 9 0 8 1; #X connect 10 0 16 1; #X connect 11 0 10 0; #X connect 12 0 14 0; #X connect 13 0 17 1; #X connect 14 0 13 0; #X connect 15 0 12 1; #X connect 16 0 17 0; #X connect 17 0 1 0; #X restore 23 172 pd decision; #X obj 576 356 *~; #N canvas 276 481 755 363 divide-by-prev 0; #X obj 283 99 inlet~; #X obj 385 101 inlet~; #X obj 284 249 outlet~; #X obj 386 249 outlet~; #X obj 107 251 outlet~; #X obj 208 253 outlet~; #X obj 250 180 *~; #X obj 217 180 *~; #X obj 182 181 *~; #X obj 149 181 *~; #X obj 149 203 +~; #X obj 217 202 -~; #X obj 92 49 tabreceive~ $0-last-real; #X obj 190 72 tabreceive~ $0-last-imag; #X connect 0 0 2 0; #X connect 0 0 9 0; #X connect 0 0 6 0; #X connect 1 0 3 0; #X connect 1 0 8 0; #X connect 1 0 7 0; #X connect 6 0 11 1; #X connect 7 0 11 0; #X connect 8 0 10 1; #X connect 9 0 10 0; #X connect 10 0 4 0; #X connect 11 0 5 0; #X connect 12 0 9 1; #X connect 12 0 7 1; #X connect 13 0 8 1; #X connect 13 0 6 1; #X restore 603 192 pd divide-by-prev; #N canvas 650 183 602 327 switch 0; #X obj 19 163 inlet~; #X obj 107 99 inlet~; #X obj 169 100 inlet~; #X obj 273 97 inlet~; #X obj 333 97 inlet~; #X obj 367 185 -~; #X obj 338 231 +~; #X obj 372 229 *~; #X obj 250 182 -~; #X obj 220 228 +~; #X obj 254 228 *~; #X obj 219 278 outlet~; #X obj 338 274 outlet~; #X text 46 28 switch between two pairs of inputs. If first inlet is one , take the left-hand pair , otherwise the right-hand one.; #X text 15 140 switch; #X text 92 76 pass this if one; #X text 269 77 pass this if zero; #X connect 0 0 10 1; #X connect 0 0 7 1; #X connect 1 0 8 0; #X connect 2 0 5 0; #X connect 3 0 9 0; #X connect 3 0 8 1; #X connect 4 0 6 0; #X connect 4 0 5 1; #X connect 5 0 7 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 8 0 10 0; #X connect 9 0 11 0; #X connect 10 0 9 1; #X restore 327 275 pd switch; #N canvas 650 183 602 327 switch 0; #X obj 19 163 inlet~; #X obj 107 99 inlet~; #X obj 169 100 inlet~; #X obj 273 97 inlet~; #X obj 333 97 inlet~; #X obj 367 185 -~; #X obj 338 231 +~; #X obj 372 229 *~; #X obj 250 182 -~; #X obj 220 228 +~; #X obj 254 228 *~; #X obj 219 278 outlet~; #X obj 338 274 outlet~; #X text 46 28 switch between two pairs of inputs. If first inlet is one , take the left-hand pair , otherwise the right-hand one.; #X text 15 140 switch; #X text 92 76 pass this if one; #X text 269 77 pass this if zero; #X connect 0 0 10 1; #X connect 0 0 7 1; #X connect 1 0 8 0; #X connect 2 0 5 0; #X connect 3 0 9 0; #X connect 3 0 8 1; #X connect 4 0 6 0; #X connect 4 0 5 1; #X connect 5 0 7 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 8 0 10 0; #X connect 9 0 11 0; #X connect 10 0 9 1; #X restore 484 266 pd switch; #X obj 655 270 r revtime; #X obj 54 476 tabreceive~ $0-hann; #X obj 94 35 tabreceive~ $0-hann; #X obj 505 112 tabreceive~ $0-inc-real; #X obj 587 134 tabreceive~ $0-inc-imag; #X obj 752 220 tabsend~ $0-last-imag; #X obj 702 243 tabsend~ $0-last-real; #X obj 559 426 tabsend~ $0-inc-imag; #X obj 484 449 tabsend~ $0-inc-real; #X msg 665 293 set $1; #X obj 665 317 s revtime-set; #X obj 800 483 loadbang; #X msg 800 509 ; pd dsp 1 ; window-size 4096 ; revtime 20; #X obj 800 411 r window-size; #X msg 800 433 set $1 4; #X obj 800 455 block~; #X obj 655 341 expr 1 - 0.2/max(0.2 , $f1); #X text 20 206 choose whether to; #X text 18 224 punch in new (amplitude ,; #X text 16 243 increment) pair; #X obj 367 26 tabreceive~ $0-amp-real; #X obj 443 50 tabreceive~ $0-amp-imag; #X obj 325 537 tabsend~ $0-amp-imag; #X obj 258 560 tabsend~ $0-amp-real; #X text 361 6 previous output amplitude , encoding both magnitude and phase; #X text 453 87 previous phase increment (unit-magnitude complex number) ; #X obj 506 134 +~ 1e-15; #X obj 366 50 +~ 1e-15; #X text 363 482 propagate amplitudes by multiplying in the; #X text 361 499 increments , which advance the phase and drop; #X text 365 514 magnitude according to revtime.; #X text 608 370 normalize increments between 0 and; #X text 606 388 1 according to revtime.; #X text 78 453 IFFT and output; #X connect 0 0 16 0; #X connect 1 0 6 1; #X connect 2 0 6 0; #X connect 3 0 5 1; #X connect 4 0 5 0; #X connect 5 0 52 0; #X connect 6 0 53 0; #X connect 7 0 1 0; #X connect 7 0 3 0; #X connect 7 0 37 0; #X connect 8 0 10 1; #X connect 9 0 10 0; #X connect 10 0 25 0; #X connect 11 0 22 1; #X connect 12 0 22 0; #X connect 13 0 21 0; #X connect 14 0 21 0; #X connect 15 0 19 0; #X connect 17 0 0 0; #X connect 18 0 15 1; #X connect 19 0 9 0; #X connect 19 0 9 1; #X connect 19 0 27 0; #X connect 19 0 28 1; #X connect 19 1 8 0; #X connect 19 1 8 1; #X connect 19 1 27 1; #X connect 19 1 28 2; #X connect 20 0 17 0; #X connect 21 0 26 0; #X connect 22 0 25 1; #X connect 23 0 2 0; #X connect 23 0 4 0; #X connect 23 0 38 0; #X connect 24 0 0 1; #X connect 25 0 28 0; #X connect 25 0 29 0; #X connect 26 0 23 1; #X connect 26 0 7 1; #X connect 27 0 29 1; #X connect 27 1 29 2; #X connect 27 2 36 0; #X connect 27 3 35 0; #X connect 28 0 20 0; #X connect 28 0 3 1; #X connect 28 0 2 1; #X connect 28 1 20 1; #X connect 28 1 1 1; #X connect 28 1 4 1; #X connect 29 0 14 0; #X connect 29 0 14 1; #X connect 29 0 23 0; #X connect 29 1 13 0; #X connect 29 1 13 1; #X connect 29 1 7 0; #X connect 30 0 39 0; #X connect 30 0 46 0; #X connect 31 0 17 1; #X connect 32 0 15 0; #X connect 33 0 56 0; #X connect 34 0 29 4; #X connect 39 0 40 0; #X connect 41 0 42 0; #X connect 43 0 44 0; #X connect 44 0 45 0; #X connect 46 0 26 1; #X connect 50 0 57 0; #X connect 51 0 11 0; #X connect 51 0 11 1; #X connect 51 0 28 4; #X connect 56 0 29 3; #X connect 57 0 12 0; #X connect 57 0 12 1; #X connect 57 0 28 3; #X restore 141 301 pd fft; #X floatatom 377 233 0 0 1000 0 - revtime-set -; #X floatatom 68 239 0 0 0 0 - - -; #X text 131 9 PIANO REVERB; #X text 418 236 reverb time; #X obj 141 331 output~; #X obj 36 333 output~; #X text 23 25 This is a phase vocoder acting as a reverberator. The sound is more coherent (less "whispered") than a real room or a standard delay-based reverberator.; #X text 25 80 The technique is to "punch" the incoming sound into channels where (1) there's a peak , and (2) the incoming sound drowns out whatever might already be there. If the sound already in any channel is louder than the input the input for that channel is ignored.; #N canvas 0 0 508 303 test-sound 0; #X obj 35 33 inlet; #X obj 36 144 osc~; #X obj 164 173 line~; #X floatatom 36 95 0 0 0 0 - - -; #X obj 37 71 mtof; #X obj 36 169 cos~; #X obj 36 193 hip~ 20; #X obj 36 118 t f b; #X obj 164 63 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 209 144 pack 0 30; #X obj 194 90 del 20; #X obj 164 116 pack 1 20; #X obj 38 224 *~; #X obj 42 270 outlet~; #X connect 0 0 4 0; #X connect 1 0 5 0; #X connect 2 0 12 1; #X connect 3 0 7 0; #X connect 4 0 3 0; #X connect 5 0 6 0; #X connect 6 0 12 0; #X connect 7 0 1 0; #X connect 7 1 8 0; #X connect 8 0 10 0; #X connect 8 0 11 0; #X connect 9 0 2 0; #X connect 10 0 9 0; #X connect 11 0 2 0; #X connect 12 0 13 0; #X restore 68 266 pd test-sound; #X text 56 217 short tone; #X obj 377 257 s revtime; #X text 24 164 For each window , the amplitude in each channel is propagated by a constant phase increment and multiplied downward by a gain that determines the "reverb time".; #N canvas 0 110 565 454 hann-window 0; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 4096 float 0; #X coords 0 1 4095 0 300 100 1; #X restore 82 311 graph; #X obj 378 165 osc~; #X obj 378 190 *~ -0.5; #X obj 378 214 +~ 0.5; #X obj 331 247 tabwrite~ $0-hann; #X obj 37 88 r window-size; #X obj 38 173 /; #X obj 127 142 samplerate~; #X obj 38 251 s window-sec; #X obj 177 204 swap; #X obj 177 228 /; #X obj 177 252 s window-hz; #X obj 49 201 * 1000; #X obj 49 228 s window-msec; #X obj 38 115 t f b f; #X msg 173 92 resize $1; #X obj 173 116 s $0-hann; #X obj 330 105 r window-hz; #X msg 382 130 0; #X obj 330 131 t f b; #X text 15 8 calculate Hann window table (variable window size) and constants window-hz (fundamental frequency of analysis) , window-sec and window-msec (analysis window size in seconds and msec).; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 5 0 14 0; #X connect 6 0 8 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 7 0 9 1; #X connect 9 0 10 0; #X connect 9 1 10 1; #X connect 10 0 11 0; #X connect 12 0 13 0; #X connect 14 0 6 0; #X connect 14 0 9 0; #X connect 14 1 7 0; #X connect 14 2 15 0; #X connect 15 0 16 0; #X connect 17 0 19 0; #X connect 18 0 1 1; #X connect 19 0 1 0; #X connect 19 1 4 0; #X connect 19 1 18 0; #X restore 360 305 pd hann-window; #N canvas 52 71 774 520 tables 0; #N canvas 0 0 450 300 graph1 0; #X array $0-last-real 2048 float 0; #X coords 0 500 2048 -500 200 150 1; #X restore 103 15 graph; #N canvas 0 0 450 300 graph2 0; #X array $0-last-imag 2048 float 0; #X coords 0 500 2048 500 200 150 1; #X restore 497 6 graph; #N canvas 0 0 450 300 graph1 0; #X array $0-amp-real 2048 float 0; #X coords 0 500 2048 -500 200 150 1; #X restore 105 185 graph; #N canvas 0 0 450 300 graph2 0; #X array $0-amp-imag 2048 float 0; #X coords 0 500 2048 -500 200 150 1; #X restore 501 178 graph; #N canvas 0 0 450 300 graph1 0; #X array $0-inc-real 2048 float 0; #X coords 0 1 2048 -1 200 150 1; #X restore 105 357 graph; #N canvas 0 0 450 300 graph2 0; #X array $0-inc-imag 2048 float 0; #X coords 0 1 2048 -1 200 150 1; #X restore 503 342 graph; #X restore 360 326 pd tables; #X text 307 383 Updated for Pd version 0.39; #X text 26 389 reverb in; #X text 133 388 reverb out; #X connect 0 0 5 0; #X connect 0 0 5 1; #X connect 1 0 11 0; #X connect 2 0 9 0; #X connect 9 0 0 0; #X connect 9 0 6 0; #X connect 9 0 6 1;
--- NEW FILE: J04.corners.pd --- #N canvas 612 -7 619 714 12; #X obj 117 132 wrap~; #X obj 117 154 -~ 0.5; #N canvas 0 0 450 300 graph1 0; #X array $0-sum 882 float 0; #X coords 0 0.25 881 -0.25 200 130 1; #X restore 411 70 graph; #X text 410 208 ---- 0.02 seconds ----; #X text 354 676 updated for Pd version 0.39; #X obj 33 427 output~; #X obj 127 461 tabwrite~ $0-sum; #X obj 117 110 -~; #X obj 139 69 / 100; #X floatatom 139 48 4 -100 100 0 - - -; #X obj 138 312 / 100; #X floatatom 138 291 4 -100 100 0 - - -; #X obj 116 334 *~; #X obj 203 133 wrap~; #X obj 203 155 -~ 0.5; #X obj 203 111 -~; #X obj 225 70 / 100; #X floatatom 225 49 4 -100 100 0 - - -; #X obj 225 313 / 100; #X floatatom 225 292 4 -100 100 0 - - -; #X obj 203 335 *~; #X obj 290 134 wrap~; #X obj 290 156 -~ 0.5; #X obj 290 112 -~; #X obj 311 71 / 100; #X floatatom 311 50 4 -100 100 0 - - -; #X obj 313 314 / 100; #X floatatom 313 293 4 -100 100 0 - - -; #X obj 291 336 *~; #X text 129 26 -- PHASES (percent) --; #X text 140 267 AMPLITUDES (percent); #X obj 91 360 +~; #X obj 92 386 +~; #X obj 138 413 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; #X obj 138 435 metro 193; #X obj 20 80 phasor~; #X floatatom 20 59 5 0 0 0 - - -; #X text 12 36 frequency; #X obj 116 184 *~; #X obj 203 184 *~; #X obj 290 184 *~; #X obj 116 209 *~ 0.5; #X obj 116 234 -~ 0.0833; #X obj 203 209 *~ 0.5; #X obj 290 209 *~ 0.5; #X obj 204 234 -~ 0.0833; #X obj 291 234 -~ 0.0833; #X text 30 3 Making waveforms with corners using parabolic waves; #X text 14 499 Here we combine three parabolic waves (in the same way as , two patches ago , we combined sawtooth waves). The parabolic wave is obtained from the sawtooth wave (assuming it runs from -0.5 to 0.5) by the formula: y=x*x/2 - 1/12. This is normalized so that the corner has a slope change of minus one unit per cycle , and adjusted to remove any DC component.; #X text 12 593 In general , the segments of the result will be curved , but if the three magnitudes sum algebraicly to zero , the segments will be linear.; #X text 371 67 0.25; #X text 362 184 -0.25; #X text 14 644 Note the reduced scale of the graph (from -0.25 to 0.25) compared to the previous examples.; #X connect 0 0 1 0; #X connect 1 0 38 0; #X connect 1 0 38 1; #X connect 7 0 0 0; #X connect 8 0 7 1; #X connect 9 0 8 0; #X connect 10 0 12 1; #X connect 11 0 10 0; #X connect 12 0 31 0; #X connect 13 0 14 0; #X connect 14 0 39 0; #X connect 14 0 39 1; #X connect 15 0 13 0; #X connect 16 0 15 1; #X connect 17 0 16 0; #X connect 18 0 20 1; #X connect 19 0 18 0; #X connect 20 0 31 1; #X connect 21 0 22 0; #X connect 22 0 40 0; #X connect 22 0 40 1; #X connect 23 0 21 0; #X connect 24 0 23 1; #X connect 25 0 24 0; #X connect 26 0 28 1; #X connect 27 0 26 0; #X connect 28 0 32 1; #X connect 31 0 32 0; #X connect 32 0 6 0; #X connect 32 0 5 0; #X connect 32 0 5 1; #X connect 33 0 34 0; #X connect 34 0 6 0; #X connect 35 0 7 0; #X connect 35 0 15 0; #X connect 35 0 23 0; #X connect 36 0 35 0; #X connect 38 0 41 0; #X connect 39 0 43 0; #X connect 40 0 44 0; #X connect 41 0 42 0; #X connect 42 0 12 0; #X connect 43 0 45 0; #X connect 44 0 46 0; #X connect 45 0 20 0; #X connect 46 0 28 0;
--- NEW FILE: J09.bandlimited.pd --- #N canvas 33 1 608 881 12; #X floatatom 201 163 0 0 0 0 - - -; #X obj 53 387 -~; #X obj 201 237 /~; #X obj 208 214 clip~ 1 999999; #X obj 76 195 phasor~; #X obj 88 257 *~; #X obj 88 281 clip~ -0.5 0.5; #X floatatom 76 147 0 0 0 0 - - -; #X floatatom 201 115 0 0 0 0 - - -; #X obj 201 139 mtof; #X text 208 45 band limit (MIDI units); #X obj 201 67 loadbang; #X obj 88 305 *~ 1000; #X obj 88 329 +~ 501; #X obj 76 219 -~ 0.5; #X text 219 397 graph output; #X obj 76 101 samplerate~; #X obj 76 125 / 512; #N canvas 49 311 450 300 fft 0; #X obj 31 41 inlet~; #X obj 35 85 rfft~; #X obj 34 118 *~; #X obj 78 118 *~; #X obj 34 161 sqrt~; #X obj 37 201 expr~ 50 + 20 * log($v1)/log(10); #X obj 38 235 max~ 0; #X obj 254 28 block~ 512; #X obj 33 263 tabsend~ $0-fft; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 1 0 2 1; #X connect 1 1 3 0; #X connect 1 1 3 1; #X connect 2 0 4 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 8 0; #X restore 126 423 pd fft; #N canvas 0 0 450 300 graph1 0; #X array $0-fft 256 float 3; #A 0 8.35364 88.2226 82.204 78.6857 76.1917 74.2598 72.6836 71.3537 70.204 69.1927 68.2904 67.4768 66.7365 66.0581 65.4323 64.8524 64.3122 63.8074 63.3336 62.8881 62.4675 62.0699 61.693 61.3352 60.9946 60.6703 60.3606 60.0649 59.7817 59.5107 59.2506 59.0011 58.7612 58.5307 58.3086 58.0948 57.8885 57.6896 57.4975 57.3119 57.1324 56.9588 56.7906 56.6279 56.4699 56.3169 56.1681 56.0239 55.8835 55.7472 55.6144 55.4853 55.3594 55.2368 55.1171 55.0005 54.8864 54.7751 54.6661 54.5596 54.4552 54.3531 54.2528 54.1546 54.0581 53.9635 53.8703 53.7788 53.6886 53.5999 53.5124 53.4262 53.341 53.257 53.1738 53.0917 53.0103 52.9299 52.85 52.771 52.6924 52.6146 52.537 52.4601 52.3835 52.3073 52.2313 52.1556 52.0801 52.0048 51.9295 51.8545 51.7793 51.7042 51.629 51.5538 51.4784 51.4029 51.3271 51.2513 51.175 51.0985 51.0216 50.9444 50.8667 50.7887 50.7102 50.6312 50.5516 50.4716 50.3909 50.3097 50.2277 50.1452 50.0619 49.978 49.8932 49.8078 49.7214 49.6344 49.5464 49.4576 49.3678 49.2771 49.1854 49.0929 48.9992 48.9046 48.8089 48.7121 48.6142 48.5152 48.415 48.3137 48.2111 48.1073 48.0022 47.8959 47.7882 47.6792 47.5688 47.4571 47.3439 47.2293 47.1131 46.9956 46.8764 46.7558 46.6334 46.5096 46.384 46.2568 46.1278 45.9972 45.8646 45.7304 45.5942 45.4563 45.3163 45.1746 45.0306 44.8849 44.7369 44.5869 44.4347 44.2804 44.1238 43.965 43.8038 43.6404 43.4744 43.3062 43.1352 42.9619 42.7858 42.6072 42.4257 42.2417 42.0546 41.8649 41.6719 41.4762 41.2771 41.0752 40.8697 40.6613 40.4491 40.2338 40.0147 39.7922 39.5657 39.3357 39.1016 38.8637 38.6214 38.3752 38.1243 37.8694 37.6096 37.3454 37.076 36.8021 36.5227 36.2385 35.9484 35.6533 35.3519 35.0451 34.7318 34.4127 34.0866 33.7542 33.4145 33.0681 32.7138 32.3524 31.9824 31.6049 31.2182 30.8233 30.4185 30.0049 29.5806 29.1467 28.7012 28.2454 27.7769 27.297 26.8034 26.2972 25.7759 25.2407 24.6887 24.1212 23.5348 22.9309 22.3055 21.6598 20.9892 20.2947 19.5705 18.8168 18.0266 17.1987 16.3231 15.3963 14.404 13.3362 12.1694 10.8809 9.42496 7.74107 5.71798 3.15337 0 0; #X coords 0 100 256 0 200 140 1; #X restore 375 275 graph; #X floatatom 375 425 5 0 0 0 - - -; #X floatatom 375 471 5 0 0 0 - - -; #X obj 52 443 output~; #X obj 88 353 tabread4~ $0-transition; #X obj 201 186 * 0.4; #X msg 201 91 136.766; #X obj 375 447 tabread $0-fft; #X obj 195 400 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 195 422 tabwrite~ $0-out; #N canvas 0 0 450 300 graph1 0; #X array $0-out 882 float 0; #X coords 0 1 882 -1 200 140 1; #X restore 378 108 graph; #X text 75 15 BAND-LIMITED SAWTOOTH GENERATOR USING A TRANSITION TABLE ; #X obj 76 60 loadbang; #X obj 76 83 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 39 657 Now any time we wish to make a discontinuity in the output signal , we make it look exactly like the bandlimited square wave looks. We do this by reading through the table we recorded , carefully adding a "digital" , non-band-limited , sawtooth to "array1" so that the discontinuities in the two cancel out and what you have left is the transition in the table.; #N canvas 151 52 754 678 transition-table 0; #X obj 428 534 cos~; #X obj 262 534 cos~; #X obj 214 529 cos~; #X msg 158 598 bang; #X text 242 138 back the phase up one sample; #X msg 295 444 -0.0005; #X obj 262 508 *~ 3; #X obj 427 510 *~ 5; #X obj 262 559 *~ 0.33333; #X obj 427 560 *~ -0.2; #X obj 214 557 *~ -1; #X msg 159 425 bang; #X obj 213 468 phasor~ 22.05; #X obj 214 590 *~ 0.57692; #X obj 204 259 cos~; #X obj 156 254 cos~; #X msg 100 323 bang; #X msg 13 195 ; pd dsp 1; #X msg 237 169 -0.0005; #X obj 204 233 *~ 3; #X obj 204 284 *~ 0.33333; #X obj 156 282 *~ -1; #X msg 100 150 bang; #X obj 155 193 phasor~ 22.05; #X obj 156 315 *~ 0.75; #X obj 214 617 tabwrite~ $0-transition; #X obj 156 342 tabwrite~ $0-transition; #X obj 100 128 loadbang; #X text 292 216 twice the table length; #X text 280 193 period is 2000 samples ,; #X text 80 369 This one is used - first and third harmonics only.; #X text 28 644 This alternate one puts in harmonics 1 , 3 , and 5 ; #N canvas 0 0 450 300 graph1 0; #X array $0-transition 1002 float 0; #X coords 0 1 1002 -1 200 140 1; #X restore 539 32 graph; #X text 537 179 ----- 1002 samples ----; #X text 24 27 This network puts a half cycle of a band-limited square wave into the table "array1."; #X text 22 64 Logically the half-cycle is in samples 1 through 1000 ; samples 0 and 1001 are provided so that the 4-point interpolation will work everywhere.; #X connect 0 0 9 0; #X connect 1 0 8 0; #X connect 2 0 10 0; #X connect 3 0 25 0; #X connect 5 0 12 1; #X connect 6 0 1 0; #X connect 7 0 0 0; #X connect 8 0 13 0; #X connect 9 0 13 0; #X connect 10 0 13 0; #X connect 11 0 5 0; #X connect 11 0 3 0; #X connect 12 0 2 0; #X connect 12 0 6 0; #X connect 12 0 7 0; #X connect 13 0 25 0; #X connect 14 0 20 0; #X connect 15 0 21 0; #X connect 16 0 26 0; #X connect 18 0 23 1; #X connect 19 0 14 0; #X connect 20 0 24 0; #X connect 21 0 24 0; #X connect 22 0 18 0; #X connect 22 0 17 0; #X connect 22 0 16 0; #X connect 23 0 15 0; #X connect 23 0 19 0; #X connect 24 0 26 0; #X connect 27 0 22 0; #X restore 182 465 pd transition-table; #X text 351 853 updated for Pd version 0.39; #X text 37 515 A more sophisticated way to control foldover in sawtooth waves is to replace the once-a-cycle jump with a bandlimited transition. To get a band-limited transition we synthesize a band-limited square wave and harvest the transition from the middle of the top half to the middle of the bottom half. Here we use a square wave at SR/10 , so that only partials 1 and 3 fit below the Nyquist. The transition should take 1/2 period , or 5 samples. The table is calculated and stored in the "transition-table" subpatch.; #X text 40 767 The "band limit" controls how fast the transition table is read. If it is set to the Nyquist frequency the table is read at 0.4 times the Nyquist , or five samples a cycle. Lowering the band limit cuts off the partials of the generated sawtooth wave at frequencies below the Nyquist.; #X connect 0 0 24 0; #X connect 1 0 18 0; #X connect 1 0 22 0; #X connect 1 0 22 1; #X connect 1 0 28 0; #X connect 2 0 5 1; #X connect 3 0 2 1; #X connect 4 0 14 0; #X connect 5 0 6 0; #X connect 6 0 12 0; #X connect 7 0 4 0; #X connect 7 0 3 0; #X connect 8 0 9 0; #X connect 9 0 0 0; #X connect 11 0 25 0; #X connect 12 0 13 0; #X connect 13 0 23 0; #X connect 14 0 5 0; #X connect 14 0 1 1; #X connect 16 0 17 0; #X connect 17 0 7 0; #X connect 20 0 26 0; #X connect 23 0 1 0; #X connect 24 0 2 0; #X connect 25 0 8 0; #X connect 26 0 21 0; #X connect 27 0 28 0; #X connect 31 0 32 0; #X connect 32 0 16 0;
--- NEW FILE: H07.measure.spectrum.pd --- #N canvas 407 54 626 729 12; #X floatatom 145 654 5 0 0 0 - - -; #X obj 44 565 bp~; #X obj 44 536 bp~; #X obj 55 467 mtof; #X floatatom 55 490 7 0 0 0 - - -; #X floatatom 98 520 3 0 999 0 - #0-q -; #X floatatom 55 447 7 0 150 0 - #0-pitch -; #X obj 145 586 env~ 4096; #X obj 45 370 *~ 0; #X obj 44 395 +~ 1; #X obj 145 608 + 0.5; #X obj 145 631 int; #X text 12 41 In this example we use two cascaded bandpass filters to troll for partials in Jonathan Harvey's famous bell sample.; #X text 16 233 You can hear partials around 48 , 51.3 , 55 (faint!) , 57 (fainter!) , 60 , two beating partials around 65 , 67 , 69 , 70.9 , 71.75 , 72.6 , 74 , 74.65 , 75.6 , 77 , 81.2 , 84.6 , 86.5 , and probably many more. There's also one down at 36 , but it's easier to see it on the meter than hear it.; #X text 124 447 <-- center pitch; #X text 120 463 (shift-drag to fine tune); #X text 131 491 <-- center frequency; #X text 138 520 <-- Q (filter selectivity); #X obj 44 614 output~; #X text 341 680 updated for Pd version 0.39; #X text 14 82 Note that filters can give unexpected level changes. The bp~ object is designed to have roughly unit gain at the pass band , so the higher you set "Q" the more amplitude is lost. You can correct for this by pushing the output amplitude , but be sure to remember to reset the output amplitude before you reduce Q again. I set the Q to 100 and the output amplitude to 110 or 120 (with the room gain way down.) Then holding the shift key , slowly drag the center pitch upward listening for modes.; #N canvas 316 21 483 471 startup 0; #X obj 53 335 r readfile; #X obj 53 388 soundfiler; #X obj 59 23 loadbang; #X obj 59 49 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 59 70 f $0; #X obj 60 271 /; #X msg 60 248 44100; #X obj 60 223 t b f; #X obj 60 199 r $0-totsamps; #X obj 60 294 s $0-loopf; #X msg 59 102 ; readfile symbol $1-array ; $1-totsamps 143718 ; $1-pitch 69 ; $1-q 0; #X msg 53 361 read -resize ../sound/bell.aiff $1; #X connect 0 0 11 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 0 10 0; #X connect 5 0 9 0; #X connect 6 0 5 0; #X connect 7 0 6 0; #X connect 7 1 5 1; #X connect 8 0 7 0; #X connect 11 0 1 0; #X restore 456 625 pd startup; #N canvas 0 0 450 300 graph1 0; #X array $0-array 155948 float 0; #X coords 0 1 155947 -1 200 150 1; #X restore 396 322 graph; #X obj 45 322 r $0-loopf; #X obj 45 346 phasor~; #X obj 44 419 tabread4~ $0-array; #X obj 89 370 r $0-totsamps; #X text 109 12 MEASURING SPECTRA USING BANDPASS FILTERS; #X connect 1 0 7 0; #X connect 1 0 18 0; #X connect 1 0 18 1; #X connect 2 0 1 0; #X connect 3 0 4 0; #X connect 4 0 2 1; #X connect 4 0 1 1; #X connect 5 0 2 2; #X connect 5 0 1 2; #X connect 6 0 3 0; #X connect 7 0 10 0; #X connect 8 0 9 0; #X connect 9 0 25 0; #X connect 10 0 11 0; #X connect 11 0 0 0; #X connect 23 0 24 0; #X connect 24 0 8 0; #X connect 25 0 2 0; #X connect 26 0 8 1;
--- NEW FILE: I05.compressor.pd --- #N canvas 557 371 620 428 12; #N canvas 297 254 646 523 fft-analysis 0; #X obj 115 409 *~; #X obj 75 409 *~; #X obj 76 114 *~; #X obj 77 88 inlet~; #X obj 76 137 rfft~; #X obj 75 466 *~; #X obj 171 177 *~; #X obj 75 432 rifft~; #X obj 75 489 outlet~; #X obj 137 177 *~; #X obj 137 200 +~; #X obj 461 85 block~ 1024 4; #X obj 137 351 clip~; #X obj 178 306 r squelch; #X obj 110 114 tabreceive~ $0-hann; #X obj 177 329 expr 0.01*$f1*$f1; #X obj 461 116 loadbang; #X obj 137 381 *~ 0.00065; #X obj 137 225 +~ 1e-20; #X obj 136 262 q8_rsqrt~; #X obj 109 466 tabreceive~ $0-hann; #X text 31 5 As in the previous patch , this works by multiplying each channel of the Fourier analysis by a real number computed from the magnitude. If the magnutude is "m" , the correction factor is 1/m , but only to an upper limit controlled by the "squelch" parameter. ; #X text 211 174 squared magnitude; #X text 219 225 protect against divide-by-zero; #X text 223 261 quick 8-bit-accurate reciprocal square root; #X text 222 277 (done by table lookup - about 0.25% accurate); #X text 193 351 limit the gain to squelch*squelch/100; #X text 238 381 normalize for 1024-point , overlap-4 Hann; #X text 151 409 multiply gain by real and complex part; #X text 152 429 of the amplitude; #X text 130 137 outputs complex amplitudes; #X msg 461 139 ; pd dsp 1 ; window-size 1024 ; squelch 10 ; squelch-set set 10; #X connect 0 0 7 1; #X connect 1 0 7 0; #X connect 2 0 4 0; #X connect 3 0 2 0; #X connect 4 0 9 0; #X connect 4 0 9 1; #X connect 4 0 1 0; #X connect 4 1 6 0; #X connect 4 1 6 1; #X connect 4 1 0 0; #X connect 5 0 8 0; #X connect 6 0 10 1; #X connect 7 0 5 0; #X connect 9 0 10 0; #X connect 10 0 18 0; #X connect 12 0 17 0; #X connect 13 0 15 0; #X connect 14 0 2 1; #X connect 15 0 12 2; #X connect 16 0 31 0; #X connect 17 0 0 1; #X connect 17 0 1 1; #X connect 18 0 19 0; #X connect 19 0 12 0; #X connect 20 0 5 1; #X restore 42 330 pd fft-analysis; #X floatatom 57 196 0 0 500 0 - squelch-set -; #X obj 57 220 s squelch; #N canvas 190 43 427 657 test-signal 0; #X obj 90 444 line~; #X obj 90 369 f; #X obj 90 524 outlet~; #X msg 90 423 0 , $1 $2; #X obj 90 397 pack 0 0; #X obj 190 344 /; #X obj 317 295 * 0.001; #X obj 90 497 hip~ 5; #X obj 35 246 loadbang; #X msg 90 322 1; #X obj 90 344 metro 1000; #X obj 259 272 t b b f; #X obj 117 270 t b f; #X obj 90 469 tabread4~ $0-sample; #X text 21 28 test signal: looped sample playback; #X obj 67 131 hip~ 5; #X obj 67 107 adc~ 1; #X obj 129 131 s insamprate; #X obj 67 70 inlet; #X obj 129 107 samplerate~; #X obj 116 246 r $0-samplength; #X obj 259 246 r $0-insamprate; #X obj 67 154 tabwrite~ $0-sample; #X connect 0 0 13 0; #X connect 1 0 4 0; #X connect 3 0 0 0; #X connect 4 0 3 0; #X connect 5 0 4 1; #X connect 5 0 10 1; #X connect 6 0 5 1; #X connect 7 0 2 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 10 0 1 0; #X connect 11 0 9 0; #X connect 11 1 5 0; #X connect 11 2 6 0; #X connect 12 0 9 0; #X connect 12 1 5 0; #X connect 12 1 1 1; #X connect 13 0 7 0; #X connect 15 0 22 0; #X connect 16 0 15 0; #X connect 18 0 19 0; #X connect 18 0 16 0; #X connect 19 0 17 0; #X connect 20 0 12 0; #X connect 21 0 11 0; #X restore 43 303 pd test-signal; #X obj 43 359 output~; #N canvas 388 86 722 350 insample 0; #N canvas 0 0 450 300 graph1 0; #X array $0-sample 155948 float 0; #X coords 0 1 155947 -1 400 150 1; #X restore 259 24 graph; #X obj 19 23 r read-sample; #X obj 19 74 unpack s f; #X obj 19 184 soundfiler; #X text 356 250 read a sample; #X obj 276 249 loadbang; #X obj 19 100 t s b; #X obj 75 99 symbol $0-sample; #X obj 19 135 pack s s; #X msg 19 160 read -resize $1 $2; #X obj 74 46 44100; #X obj 19 47 t a b; #X msg 276 273 ; read-sample ../sound/bell.aiff; #X obj 29 208 s $0-samplength; #X obj 116 74 s $0-insamprate; #X obj 19 247 /; #X obj 19 271 * 1000; #X obj 19 294 s $0-samp-msec; #X obj 57 247 r $0-insamprate; #X connect 1 0 11 0; #X connect 2 0 6 0; #X connect 2 1 14 0; #X connect 3 0 13 0; #X connect 3 0 15 0; #X connect 5 0 12 0; #X connect 6 0 8 0; #X connect 6 1 7 0; #X connect 7 0 8 1; #X connect 8 0 9 0; #X connect 9 0 3 0; #X connect 10 0 14 0; #X connect 11 0 2 0; #X connect 11 1 10 0; #X connect 15 0 16 0; #X connect 16 0 17 0; #X connect 18 0 15 1; #X restore 223 313 pd insample; #X text 362 406 updated for Pd version 0.39; #X text 56 43 Here we divide each complex channel in the Fourier analysis by its own magnitude to "flatten" the spectrum. The "squelch" control limits the amplitude boost the algorithm will apply. If infinite , you'll get a white spectrum. If less , the louder parts of the spectrum will be flattened but the quieter ones will only be boosted by the squelch value.; #X text 73 6 DYNAMIC RANGE COMPRESSION BY FOURIER ANALYSIS CHANNEL ; #X floatatom 223 366 5 0 0 0 - #0-samp-msec -; #X obj 43 282 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 62 281 <- record; #X text 276 365 sample length , msec; #X msg 292 183 ../sound/bell.aiff; #X msg 292 208 ../sound/voice.wav; #X msg 292 233 ../sound/voice2.wav; #X text 91 197 <- squelch; #X text 295 161 change input sound; #X obj 292 259 s read-sample; #N canvas 0 110 565 454 hann-window 0; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 1024 float 0; #X coords 0 1 1023 0 300 100 1; #X restore 82 311 graph; #X obj 378 165 osc~; #X obj 378 190 *~ -0.5; #X obj 378 214 +~ 0.5; #X obj 331 247 tabwrite~ $0-hann; #X obj 37 88 r window-size; #X obj 38 173 /; #X obj 127 142 samplerate~; #X obj 38 251 s window-sec; #X obj 177 204 swap; #X obj 177 228 /; #X obj 177 252 s window-hz; #X obj 49 201 * 1000; #X obj 49 228 s window-msec; #X obj 38 115 t f b f; #X msg 173 92 resize $1; #X obj 173 116 s $0-hann; #X obj 330 105 r window-hz; #X msg 382 130 0; #X obj 330 131 t f b; #X text 15 8 calculate Hann window table (variable window size) and constants window-hz (fundamental frequency of analysis) , window-sec and window-msec (analysis window size in seconds and msec).; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 5 0 14 0; #X connect 6 0 8 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 7 0 9 1; #X connect 9 0 10 0; #X connect 9 1 10 1; #X connect 10 0 11 0; #X connect 12 0 13 0; #X connect 14 0 6 0; #X connect 14 0 9 0; #X connect 14 1 7 0; #X connect 14 2 15 0; #X connect 15 0 16 0; #X connect 17 0 19 0; #X connect 18 0 1 1; #X connect 19 0 1 0; #X connect 19 1 4 0; #X connect 19 1 18 0; #X restore 223 335 pd hann-window; #X connect 0 0 4 0; #X connect 0 0 4 1; #X connect 1 0 2 0; #X connect 3 0 0 0; #X connect 10 0 3 0; #X connect 13 0 18 0; #X connect 14 0 18 0; #X connect 15 0 18 0;
--- NEW FILE: J06.enveloping.pd --- #N canvas 4 -26 874 736 12; #N canvas 0 0 450 300 graph1 0; #X array $0-waveform 882 float 0; #X coords 0 1.02 881 -1.02 200 130 1; #X restore 639 379 graph; #X floatatom 47 25 0 0 20 0 - - -; #N canvas 0 0 450 300 graph1 0; #X array $0-env 22050 float 0; #X coords 0 1.02 22049 -1.02 200 130 1; #X restore 638 189 graph; #X obj 47 52 phasor~; #X text 126 2 ENVELOPE GENERATORS FROM LINE SEGMENTS; #X obj 19 514 output~; #X text 610 698 updated for Pd version 0.39; #X obj 46 98 *~; #X obj 11 165 -~; #X obj 10 214 *~; #X floatatom 68 75 3 0 100 0 - - -; #X obj 16 244 min~; #X floatatom 68 123 3 0 100 0 - - -; #X obj 68 146 / 100; #X floatatom 68 172 3 0 100 0 - - -; #X obj 60 386 *~ 2; #X obj 60 409 min~; #X obj 110 386 -~ 1; #X obj 60 358 phasor~ 200; #X obj 18 477 *~; #X obj 27 326 tabwrite~ $0-env; #X obj 38 306 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 195 * -1; #X obj 69 457 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 61 478 tabwrite~ $0-waveform; #X obj 111 409 *~ -3; #X obj 60 432 -~ 0.5; #X text 639 514 ----- 0.02 second ----; #X text 86 24 <-- frequency (Hz.); #X text 636 322 ----- 0.5 second ------; #X text 107 72 <-- slope of rise segment. Just multiply this by the phase to make the segment.; #X text 129 140 Subtract this to make the phasor cross zero at the desired point of the cycle.; #X text 107 173 <-- slope of decay segment.; #X text 112 190 multiply the phasor (with the zero crossing shifted as above) by the desired slope , negating it so the segment points downward.; #X text 63 244 minimum of rise and decay segments (makes a triangle wave); #X obj 17 267 clip~ 0 1; #X text 109 266 clip the triangle wave to between 0 and 1 , to make the sustain and silent regions.; #X text 108 121 <-- Duty cycle (end of decay segment as % of cycle.) ; #X text 60 304 <-- click to graph envelope shape; #X text 91 456 <-- click to graph audio waveform; #X text 172 364 this makes a quick-and-dirty triangle wave; #X text 172 382 as described in the previous patch. It's; #X text 172 419 to listen to.; #X text 97 511 You can make a phasor-generated envelope generator using "min" and "clip" to combine line segments. Here a rise segment starts at phase 0 , and a decay segment passes through zero at a controllable point (the "duty cycle" , as a percentage of a cycle.) Each has a controllable slope (in units per cycle). The resulting triangle wave (the minimum of the rise and decay segments) is limited to 1 , thus making a flat "sustain" segment (unless the rise and decay segments meet at a value less than one , in which case there is none). Limiting below by 0 prevents us from following the decay segment into negative values. Reasonable values to start with are 6 Hz. frequency , rise and decay slope 10 , duty cycle 75%.; #X text 173 401 used here so we'll have something; #X connect 1 0 3 0; #X connect 3 0 7 0; #X connect 3 0 8 0; #X connect 7 0 11 1; #X connect 8 0 9 0; #X connect 9 0 11 0; #X connect 10 0 7 1; #X connect 11 0 35 0; #X connect 12 0 13 0; #X connect 13 0 8 1; #X connect 14 0 22 0; #X connect 15 0 16 0; #X connect 16 0 26 0; #X connect 17 0 25 0; #X connect 18 0 15 0; #X connect 18 0 17 0; #X connect 19 0 5 0; #X connect 19 0 5 1; #X connect 21 0 20 0; #X connect 22 0 9 1; #X connect 23 0 24 0; #X connect 25 0 16 1; #X connect 26 0 24 0; #X connect 26 0 19 1; #X connect 35 0 19 0; #X connect 35 0 20 0;
--- NEW FILE: H13.butterworth.pd --- #N canvas 49 22 840 502 12; #N canvas 0 0 450 300 graph2 0; #X array $0-tab1 100 float 1; #A 0 0.999974 0.998121 0.998981 1.00106 1.00019 1.00133 1.00017 0.997406 0.995891 0.986251 0.976591 0.959539 0.93749 0.903172 0.859824 0.805118 0.744756 0.682757 0.617726 0.555802 0.496807 0.443599 0.395099 0.351557 0.313317 0.279982 0.250867 0.225225 0.202565 0.182842 0.165875 0.150662 0.13708 0.125107 0.11452 0.105018 0.0965065 0.0887956 0.0819179 0.0757449 0.0701302 0.0650313 0.0604129 0.056344 0.0525467 0.0490616 0.04589 0.0429836 0.0403206 0.0378735 0.0355742 0.0334788 0.0315483 0.0297412 0.0280809 0.0265134 0.0251207 0.0237881 0.0225431 0.0213794 0.0203074 0.0192861 0.0183551 0.0174563 0.0166231 0.0158432 0.0151 0.0144158 0.0137608 0.0131513 0.0125729 0.0120266 0.0115073 0.0110253 0.0105541 0.0101301 0.00971218 0.0093198 0.00894806 0.00859575 0.00825236 0.00794149 0.00763651 0.00734779 0.00707258 0.0068092 0.00656191 0.0063171 0.00609739 0.00587868 0.0056713 0.00547262 0.00528366 0.00509866 0.00493017 0.00476291 0.00460384 0.00445121 0.00430475 0.00416536; #X coords 0 5 99 0 200 300 1; #X restore 615 71 graph; #X obj 32 250 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 40 294 3 0 0 0 - - -; #X text 670 377 frequency; #N canvas 876 177 375 255 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X msg 22 91 ; $1-lf 80 ; $1-hf 150 ;; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X restore 324 431 pd startup; #X text 553 359 gain=0; #X obj 32 446 filter-graph2 $0-tab1; #X text 593 60 5; #X text 610 370 0; #X text 598 301 1; #X text 575 435 updated for Pd version 0.39; #X text 186 -4 BUTTERWORTH FILTER; #X obj 216 398 butterworth3~; #X floatatom 244 340 3 0 100 0 - #0-lf -; #X floatatom 291 339 3 85 150 0 - #0-hf -; #X obj 244 366 mtof; #X obj 291 366 mtof; #X text 790 373 5000; #X obj 32 271 filter-graph1 100 5000; #X text 232 318 poles; #X text 288 318 zeros; #X text 24 20 The butterworth filter can be configured for low-pass , high-pass , and shelving , depending on the placement of the poles and zeros. For low-pass , the poles are placed to set the cutoff frequency and the zeros are at -1 (the Nyquist). Leaving the poles fixed and moving the zeros then gives shelving filters. In this example , the actual filtering is relegated to an abstraction (butterworth3~) which takes frequencies corresponding to the pole and zero placement.; #X text 24 147 The butterworth3~ abstraction computes filter coeffients using control messages , and so it is not suitable for continuously time-varying Butterworth filters. For that , it is often appropriate to use time-saving approximations , but precisely which approximations to use will depend on the way the filter is to be used.; #X connect 1 0 18 0; #X connect 12 0 6 3; #X connect 13 0 15 0; #X connect 14 0 16 0; #X connect 15 0 12 1; #X connect 16 0 12 2; #X connect 18 0 2 0; #X connect 18 0 6 0; #X connect 18 1 6 1; #X connect 18 1 12 0; #X connect 18 2 6 2;
--- NEW FILE: J08.classicsynth.pd --- #N canvas 203 294 592 528 12; #N canvas 158 4 781 654 16x 0; #X obj 69 345 *~ 0.064; #X obj 69 368 rpole~ 0.93538; #X obj 69 391 *~ 0.00431; #X obj 69 414 cpole~ 0.96559 0.05592; #X obj 69 440 cpole~ 0.96559 -0.05592; #X obj 69 463 *~ 0.125; #X obj 69 486 rzero~ -1; #X obj 69 509 rzero~ -1; #X obj 69 532 rzero~ -1; #X obj 63 97 phasor~; #X obj 69 566 outlet~; #X obj 86 151 wrap~; #X obj 86 127 -~; #X obj 86 175 *~; #X obj 63 204 +~; #X obj 271 156 phasor~; #X obj 294 210 wrap~; #X obj 294 186 -~; #X obj 294 234 *~; #X obj 271 263 +~; #X obj 64 271 +~; #X obj 457 31 block~ 1024 1 16; #X obj 62 29 inlet; #X obj 250 34 r osc-params; #X obj 250 57 unpack 0 0 0 0 0 0; #X obj 272 100 *~; #X obj 272 128 +~; #X msg 341 338 ; osc-params 0.5 -0.5 0.5 0.5 1 0.5; #X obj 341 312 loadbang; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 1 4 1; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 8 0 10 0; #X connect 9 0 12 0; #X connect 9 0 14 0; #X connect 11 0 13 0; #X connect 12 0 11 0; #X connect 13 0 14 1; #X connect 14 0 20 0; #X connect 15 0 17 0; #X connect 15 0 19 0; #X connect 16 0 18 0; #X connect 17 0 16 0; #X connect 18 0 19 1; #X connect 19 0 20 1; #X connect 20 0 0 0; #X connect 22 0 9 0; #X connect 22 0 25 0; #X connect 23 0 24 0; #X connect 24 0 12 1; #X connect 24 1 13 1; #X connect 24 2 17 1; #X connect 24 3 18 1; #X connect 24 4 25 1; #X connect 24 5 26 1; #X connect 25 0 26 0; #X connect 26 0 15 0; #X connect 28 0 27 0; #X restore 41 160 pd 16x; #X obj 44 255 output~; #X text 333 501 Updated for Pd version 0.39; #X text 151 7 THE CLASSIC SUBTRACTIVE SYNTH SOUND; #X obj 152 132 *~; #X obj 151 102 +~ 0.2; #X obj 151 156 *~ 2000; #X obj 108 221 *~; #X obj 43 218 *~; #X obj 41 122 mtof; #X obj 41 13 r $0-note; #X obj 41 62 makenote 1; #X obj 404 150 + 20; #X obj 404 102 metro 300; #X obj 404 80 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X obj 404 201 s $0-note; #X obj 404 125 random 70; #X obj 42 192 vcf~ 3; #X floatatom 228 112 3 0 0 0 - - -; #X floatatom 228 157 7 0 0 0 - - -; #X obj 228 133 mtof; #X obj 108 196 adsr 2 30 200 50 500; #X obj 151 77 adsr 1 10 200 50 500; #X obj 404 175 pack 0 200; #X obj 41 92 poly 1 1; #X obj 41 36 unpack; #X floatatom 480 80 3 0 0 0 - - -; #X floatatom 489 154 3 0 0 0 - - -; #X text 31 323 Now that we can make reasonably high-quality classic waveforms using upsampling , we combine an upsampled oscillator with a "vcf" filter and ADSR generators to control the filter resonant frequency and the amplitude to make the classic subtractive synthesis sound. Send an "s $0-note" object a (pitch , duration) pair to play a note. (Classic VC synths did not have velocity sensitive keyboards!) You can add controls to change the parameters of the ADSR envelopes and/or the vcf~ "Q" parameter. THe oscillators' waveforms and tuning relationship is controlled by other parameters set within the "pd 16x" window.; #X connect 0 0 17 0; #X connect 4 0 6 0; #X connect 5 0 4 0; #X connect 5 0 4 1; #X connect 6 0 17 1; #X connect 7 0 8 1; #X connect 8 0 1 0; #X connect 8 0 1 1; #X connect 9 0 0 0; #X connect 10 0 25 0; #X connect 11 0 24 0; #X connect 11 1 24 1; #X connect 12 0 23 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 16 0 12 0; #X connect 17 0 8 0; #X connect 18 0 20 0; #X connect 19 0 6 1; #X connect 20 0 19 0; #X connect 21 0 7 0; #X connect 21 0 7 1; #X connect 22 0 5 0; #X connect 23 0 15 0; #X connect 24 1 9 0; #X connect 24 2 22 0; #X connect 24 2 21 0; #X connect 25 0 11 0; #X connect 25 1 11 2; #X connect 26 0 13 1; #X connect 27 0 23 1;
--- NEW FILE: I06.timbre.stamp.pd --- #N canvas 72 0 668 530 12; #N canvas 147 0 795 617 fft-analysis 0; #X obj 94 511 *~; #X obj 55 511 *~; #X obj 413 356 *~; #X obj 372 356 *~; #X obj 372 379 +~; #X obj 54 183 *~; #X obj 54 158 inlet~; #X obj 54 206 rfft~; #X obj 54 560 *~; #X obj 141 245 *~; #X obj 372 333 rfft~; #X obj 54 535 rifft~; #X obj 54 583 outlet~; #X obj 107 245 *~; #X obj 107 268 +~; #X text 458 408 modulus; #X obj 107 420 *~; #X obj 600 13 block~ 1024 4; #X obj 107 398 clip~; #X obj 87 184 tabreceive~ $0-hann; #X obj 599 53 loadbang; #X obj 148 346 r squelch; #X obj 147 369 expr 0.01*$f1*$f1; #X obj 107 294 +~ 1e-20; #X obj 108 480 *~ 0.00065; #X obj 87 560 tabreceive~ $0-hann; #X obj 373 307 *~; #X obj 373 282 inlet~; #X obj 406 308 tabreceive~ $0-hann; #X obj 107 321 q8_rsqrt~; #X obj 372 402 q8_sqrt~; #X text 458 425 of control; #X text 456 442 amplitude; #X text 196 248 reciprocal; #X text 199 267 modulus of; #X text 195 287 filter input; #X text 196 306 amplitude; #X msg 599 76 ; pd dsp 1 ; window-size 1024 ; squelch 30 ; squelch-set set 30; #X text 115 159 filter input; #X text 438 282 control source; #X text 434 332 Fourier transform; #X text 28 17 Internal workings of the timbre stamping algorithm. First the "filter input" is treated as in the compressor patch , multiplying each channel amplitude by one over its modulus (but limited by the "squelch" parameter.) It is then multiplied by the modulus of the channel amplitude for the control source (which is Fourier analyzed in parallel with the filter input.); #X text 145 422 multiply the two amplitude; #X text 143 439 factors (for compression; #X text 145 455 and to apply new timbre); #X connect 0 0 11 1; #X connect 1 0 11 0; #X connect 2 0 4 1; #X connect 3 0 4 0; #X connect 4 0 30 0; #X connect 5 0 7 0; #X connect 6 0 5 0; #X connect 7 0 13 0; #X connect 7 0 13 1; #X connect 7 0 1 0; #X connect 7 1 9 0; #X connect 7 1 9 1; #X connect 7 1 0 0; #X connect 8 0 12 0; #X connect 9 0 14 1; #X connect 10 0 3 0; #X connect 10 0 3 1; #X connect 10 1 2 0; #X connect 10 1 2 1; #X connect 11 0 8 0; #X connect 13 0 14 0; #X connect 14 0 23 0; #X connect 16 0 24 0; #X connect 18 0 16 0; #X connect 19 0 5 1; #X connect 20 0 37 0; #X connect 21 0 22 0; #X connect 22 0 18 2; #X connect 23 0 29 0; #X connect 24 0 0 1; #X connect 24 0 1 1; #X connect 25 0 8 1; #X connect 26 0 10 0; #X connect 27 0 26 0; #X connect 28 0 26 1; #X connect 29 0 18 0; #X connect 30 0 16 1; #X restore 86 444 pd fft-analysis; #X text 137 12 CORT&ZACK's SECRET; #X text 27 422 filter; #X text 29 437 input; #X text 232 441 source; #X text 233 422 control; #X floatatom 53 300 0 0 500 0 - squelch-set -; #X obj 53 324 s squelch; #X obj 86 468 output~; #X msg 157 278 ../sound/bell.aiff; #X msg 157 303 ../sound/voice.wav; #X msg 157 328 ../sound/voice2.wav; #X obj 157 354 s read-sound1; #X msg 373 280 ../sound/bell.aiff; #X msg 373 305 ../sound/voice.wav; #X msg 373 330 ../sound/voice2.wav; #X obj 373 355 s read-sound2; #X text 386 256 control source; #X text 169 255 filter input; #X text 255 231 change input sounds; #X floatatom 454 409 5 0 0 0 - #0-samp-msec -; #X obj 87 394 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 215 395 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #N canvas 190 43 661 593 test-signals 0; #X obj 90 444 line~; #X obj 90 369 f; #X obj 90 524 outlet~; #X msg 90 423 0 , $1 $2; #X obj 90 397 pack 0 0; #X obj 190 344 /; #X obj 249 325 * 0.001; #X obj 90 497 hip~ 5; #X obj 35 246 loadbang; #X msg 90 322 1; #X obj 90 344 metro 1000; #X obj 191 302 t b b f; #X obj 117 270 t b f; #X obj 90 469 tabread4~ $0-sample; #X text 21 28 test signal: looped sample playback; #X obj 40 159 hip~ 5; #X obj 40 135 adc~ 1; #X obj 102 159 s insamprate; #X obj 40 98 inlet; #X obj 102 135 samplerate~; #X obj 116 246 r $0-samplength; #X obj 191 276 r $0-insamprate; #X obj 40 182 tabwrite~ $0-sample; #X obj 398 437 line~; #X obj 398 362 f; #X obj 398 517 outlet~; #X msg 398 416 0 , $1 $2; #X obj 398 390 pack 0 0; #X obj 498 337 /; #X obj 557 318 * 0.001; #X obj 398 490 hip~ 5; #X obj 343 239 loadbang; #X msg 398 315 1; #X obj 398 337 metro 1000; #X obj 499 295 t b b f; #X obj 425 263 t b f; #X obj 348 152 hip~ 5; #X obj 348 128 adc~ 1; #X obj 348 91 inlet; #X obj 410 128 samplerate~; #X obj 410 152 s insamprate2; #X obj 348 175 tabwrite~ $0-sample2; #X obj 424 239 r $0-samplength2; #X obj 499 269 r $0-insamprate2; #X obj 398 462 tabread4~ $0-sample2; #X connect 0 0 13 0; #X connect 1 0 4 0; #X connect 3 0 0 0; #X connect 4 0 3 0; #X connect 5 0 4 1; #X connect 5 0 10 1; #X connect 6 0 5 1; #X connect 7 0 2 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 10 0 1 0; #X connect 11 0 9 0; #X connect 11 1 5 0; #X connect 11 2 6 0; #X connect 12 0 9 0; #X connect 12 1 5 0; #X connect 12 1 1 1; #X connect 13 0 7 0; #X connect 15 0 22 0; #X connect 16 0 15 0; #X connect 18 0 19 0; #X connect 18 0 16 0; #X connect 19 0 17 0; #X connect 20 0 12 0; #X connect 21 0 11 0; #X connect 23 0 44 0; #X connect 24 0 27 0; #X connect 26 0 23 0; #X connect 27 0 26 0; #X connect 28 0 27 1; #X connect 28 0 33 1; #X connect 29 0 28 1; #X connect 30 0 25 0; #X connect 31 0 32 0; #X connect 32 0 33 0; #X connect 33 0 24 0; #X connect 34 0 32 0; #X connect 34 1 28 0; #X connect 34 2 29 0; #X connect 35 0 32 0; #X connect 35 1 28 0; #X connect 35 1 24 1; #X connect 36 0 41 0; #X connect 37 0 36 0; #X connect 38 0 39 0; #X connect 38 0 37 0; #X connect 39 0 40 0; #X connect 42 0 35 0; #X connect 43 0 34 0; #X connect 44 0 30 0; #X restore 87 415 pd test-signals; #X text 104 393 <- record ->; #N canvas 388 86 722 350 insample2 0; #N canvas 0 0 450 300 graph1 0; #X array $0-sample2 62079 float 0; #X coords 0 1 62078 -1 400 150 1; #X restore 298 24 graph; #X obj 19 74 unpack s f; #X obj 19 184 soundfiler; #X text 356 250 read a sample; #X obj 276 249 loadbang; #X obj 19 100 t s b; #X obj 19 135 pack s s; #X msg 19 160 read -resize $1 $2; #X obj 74 46 44100; #X obj 19 47 t a b; #X obj 19 247 /; #X obj 19 271 * 1000; #X obj 19 23 r read-sound2; #X obj 116 74 s $0-insamprate2; #X obj 75 99 symbol $0-sample2; #X obj 29 208 s $0-samplength2; #X obj 57 247 r $0-insamprate2; #X obj 19 294 s $0-samp2-msec; #X msg 276 273 ; read-sound2 ../sound/voice.wav; #X connect 1 0 5 0; #X connect 1 1 13 0; #X connect 2 0 10 0; #X connect 2 0 15 0; #X connect 4 0 18 0; #X connect 5 0 6 0; #X connect 5 1 14 0; #X connect 6 0 7 0; #X connect 7 0 2 0; #X connect 8 0 13 0; #X connect 9 0 1 0; #X connect 9 1 8 0; #X connect 10 0 11 0; #X connect 11 0 17 0; #X connect 12 0 9 0; #X connect 14 0 6 1; #X connect 16 0 10 1; #X restore 334 430 pd insample2; #N canvas 388 86 722 350 insample1 0; #N canvas 0 0 450 300 graph1 0; #X array $0-sample 155948 float 0; #X coords 0 1 155947 -1 400 150 1; #X restore 259 24 graph; #X obj 19 74 unpack s f; #X obj 19 184 soundfiler; #X text 356 250 read a sample; #X obj 276 249 loadbang; #X obj 19 100 t s b; #X obj 75 99 symbol $0-sample; #X obj 19 135 pack s s; #X msg 19 160 read -resize $1 $2; #X obj 74 46 44100; #X obj 19 47 t a b; #X obj 29 208 s $0-samplength; #X obj 116 74 s $0-insamprate; #X obj 19 247 /; #X obj 19 271 * 1000; #X obj 19 294 s $0-samp-msec; #X obj 57 247 r $0-insamprate; #X obj 19 23 r read-sound1; #X msg 276 273 ; read-sound1 ../sound/bell.aiff; #X connect 1 0 5 0; #X connect 1 1 12 0; #X connect 2 0 11 0; #X connect 2 0 13 0; #X connect 4 0 18 0; #X connect 5 0 7 0; #X connect 5 1 6 0; #X connect 6 0 7 1; #X connect 7 0 8 0; #X connect 8 0 2 0; #X connect 9 0 12 0; #X connect 10 0 1 0; #X connect 10 1 9 0; #X connect 13 0 14 0; #X connect 14 0 15 0; #X connect 16 0 13 1; #X connect 17 0 10 0; #X restore 334 408 pd insample1; #X floatatom 453 432 5 0 0 0 - #0-samp2-msec -; #N canvas 0 110 565 454 hann-window 0; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 1024 float 0; #X coords 0 1 1023 0 300 100 1; #X restore 82 311 graph; #X obj 378 165 osc~; #X obj 378 190 *~ -0.5; #X obj 378 214 +~ 0.5; #X obj 331 247 tabwrite~ $0-hann; #X obj 37 88 r window-size; #X obj 38 173 /; #X obj 127 142 samplerate~; #X obj 38 251 s window-sec; #X obj 177 204 swap; #X obj 177 228 /; #X obj 177 252 s window-hz; #X obj 49 201 * 1000; #X obj 49 228 s window-msec; #X obj 38 115 t f b f; #X msg 173 92 resize $1; #X obj 173 116 s $0-hann; #X obj 330 105 r window-hz; #X msg 382 130 0; #X obj 330 131 t f b; #X text 15 8 calculate Hann window table (variable window size) and constants window-hz (fundamental frequency of analysis) , window-sec and window-msec (analysis window size in seconds and msec).; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 5 0 14 0; #X connect 6 0 8 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 7 0 9 1; #X connect 9 0 10 0; #X connect 9 1 10 1; #X connect 10 0 11 0; #X connect 12 0 13 0; #X connect 14 0 6 0; #X connect 14 0 9 0; #X connect 14 1 7 0; #X connect 14 2 15 0; #X connect 15 0 16 0; #X connect 17 0 19 0; #X connect 18 0 1 1; #X connect 19 0 1 0; #X connect 19 1 4 0; #X connect 19 1 18 0; #X restore 334 455 pd hann-window; #X text 509 412 sample lengths ,; #X text 510 427 msec; #X text 27 35 This is a Fourier-based "vocoder" (perhaps better called a "timbre stamp") like the one the Convolution brothers use. The "control source" is analyzed to get its spectral envelope , which is then stamped onto the "filter input" by adjusting the amplitudes of its Fourier transform. The "filter input" is first whitened by the compression algorithm from the previous patch in this series. The best value of "squelch" to use depends critically on what kind of sounds are used for the filter input and the control source.; #X text 402 498 updated for Pd version 0.39; #X connect 0 0 8 0; #X connect 0 0 8 1; #X connect 6 0 7 0; #X connect 9 0 12 0; #X connect 10 0 12 0; #X connect 11 0 12 0; #X connect 13 0 16 0; #X connect 14 0 16 0; #X connect 15 0 16 0; #X connect 21 0 23 0; #X connect 22 0 23 1; #X connect 23 0 0 0; #X connect 23 1 0 1;
--- NEW FILE: J01.even.odd.pd --- #N canvas 213 27 782 599 12; #X obj 80 156 wrap~; #N canvas 0 0 450 300 graph1 0; #X array $0-phasor 882 float 0; #X coords 0 1.02 882 -1.02 200 130 1; #X restore 567 35 graph; #X obj 24 57 -~ 0.5; #X obj 80 184 -~ 0.5; #N canvas 0 0 450 300 graph1 0; #X array $0-sum 882 float 0; #X coords 0 1.02 882 -1.02 200 130 1; #X restore 567 189 graph; #N canvas 0 0 450 300 graph1 0; #X array $0-difference 882 float 0; #X coords 0 1.02 882 -1.02 200 130 1; #X restore 566 343 graph; #X text 570 475 ---- 0.02 seconds ----; #X text 528 567 updated for Pd version 0.39; #X obj 22 335 output~; #X obj 138 78 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 29 270 output~; #X text 41 -1 Splitting a sawtooth wave into even and odd harmonics ; #X obj 24 29 phasor~ 100; #X text 87 58 remove DC bias; #X text 132 29 original sawtooth; #X text 144 173 180-degree-out-of-phase; #X text 147 188 sawtooth; #X text 145 212 form the sum and difference; #X obj 23 224 +~; #X obj 59 223 -~; #X text 4 408 This patch splits a sawtooth wave into its even and odd harmonics. The wrap~ object is used to make the phased copy. Adding and subtracting this to and from the original gives the results shown and heard. (Listen to the two outputs separately , then together.) ; #X text 102 291 output level; #X text 93 367 for sum; #X text 95 350 output level; #X text 100 308 for difference; #X text 157 77 <-- click to graph; #X msg 148 97 ; pd DSP 1; #X obj 138 247 tabwrite~ $0-difference; #X obj 138 270 tabwrite~ $0-sum; #X obj 138 138 tabwrite~ $0-phasor; #X text 4 491 This is a classic technique for gaining separate control over the even and odd harmonics in a synthetic sound. It can also be used conceptually to understand the harmonic content of a square wave in terms of that of a sawtooth , or vice versa.; #X connect 0 0 3 0; #X connect 2 0 0 0; #X connect 2 0 18 0; #X connect 2 0 19 0; #X connect 2 0 29 0; #X connect 3 0 18 1; #X connect 3 0 19 1; #X connect 9 0 26 0; #X connect 9 0 27 0; #X connect 9 0 28 0; #X connect 9 0 29 0; #X connect 12 0 2 0; #X connect 18 0 8 0; #X connect 18 0 28 0; #X connect 19 0 10 1; #X connect 19 0 27 0;
--- NEW FILE: I03.resynthesis.pd --- #N canvas 73 310 580 406 12; #N canvas 265 48 643 640 fft-analysis 0; #X obj 15 164 *~; #X obj 14 99 inlet~; #X obj 15 218 rfft~; #X obj 36 140 tabreceive~ $0-hann; #X obj 14 353 *~; #X obj 56 353 *~; #X obj 15 8 block~ 512 4; #X text 85 88 The inlet~ now re-uses 3/4 of the previous block , along with the 128 new samples.; #X text 221 141 window function as before.; #X obj 76 196 tabreceive~ $0-gain; #X obj 77 225 *~; #X obj 16 506 *~; #X obj 37 481 tabreceive~ $0-hann; #X obj 77 283 /~ 768; #X text 98 301 divide by 3N/2 (factor of N because rfft and rifft aren't normalized , and 3/2 is the gain of overlap-4 reconstruction when Hann window function is applied twice.); #X text 120 216 Just to show we're doing something , we multiply each channel by a gain controlled by an array in the main window. The control is quartic-scaled for easy editing.; #X obj 78 251 *~; #X text 92 357 Multiply the (complex-valued) spectrum amplitudes by the (real-valued) gain-and-normalization-factor; #X obj 15 399 rifft~; #X text 89 396 Real-valued inverse Fourier transform. This uses only the first N/@ points of its inputs , supplying the rest by symmerty (so it's OK that rfft~ obly puts out those N/2 points.) There's only one outlet because the output is real-valued.; #X obj 16 566 outlet~; #X text 88 499 Multiply by the Hann window function again , necessary because the operation we performed might result in a signal that doesn't go smoothly to zero at both ends.; #X text 89 566 This repackages the output into 64-sample chunks for the parent window. Since we're operating with an overlap , the outlet~ object performs an overlapped sum of the blocks computed in this window. ; #X text 129 8 block~ object specifies vector size of 512 and overlap four. This window now computes blocks of 512 samples at intervals of 128 samples computed on the parent patch.; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 2 0 4 0; #X connect 2 1 5 0; #X connect 3 0 0 1; #X connect 4 0 18 0; #X connect 5 0 18 1; #X connect 9 0 10 0; #X connect 9 0 10 1; #X connect 10 0 16 0; #X connect 10 0 16 1; #X connect 11 0 20 0; #X connect 12 0 11 1; #X connect 13 0 4 1; #X connect 13 0 5 1; #X connect 16 0 13 0; #X connect 18 0 11 0; #X restore 26 289 pd fft-analysis; #X text 290 362 updated for Pd version 0.39; #N canvas 35 66 592 433 Hann-window 0; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 512 float 0; #X coords 0 1 511 0 200 120 1; #X restore 293 249 graph; #X msg 171 263 0; #X obj 65 312 osc~; #X obj 65 264 samplerate~; #X obj 65 335 *~ -0.5; #X obj 65 358 +~ 0.5; #X obj 57 383 tabwrite~ $0-hann; #X text 279 241 1; #X text 272 359 0; #X text 288 372 0; #X obj 65 288 / 512; #X obj 57 241 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 336 221 Hann window; #X text 113 310 period 512; #X text 90 215 recalculate Hann; #X text 125 230 window table; #X obj 57 146 loadbang; #X msg 79 179 ; pd dsp 1; #X text 40 27 The Hann window is now recomputed on 'loadbang' to make the file smaller (it doesn't have to be saved with the array.); #X text 474 375 511; #X connect 1 0 2 1; #X connect 2 0 4 0; #X connect 3 0 10 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 10 0 2 0; #X connect 11 0 3 0; #X connect 11 0 1 0; #X connect 11 0 6 0; #X connect 16 0 11 0; #X connect 16 0 17 0; #X restore 192 318 pd Hann-window; #X obj 27 323 output~; #X obj 25 264 noise~; #N canvas 0 0 450 300 graph1 0; #X array $0-gain 256 float 3; #A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; #X coords 0 1 256 -0.01 512 60 1; #X restore 22 168 graph; #X msg 192 264 const 0; #X obj 192 293 s $0-gain; #X text 138 0 FOURIER RESYNTHESIS; #X text 6 218 0; #X text 6 159 1; #X text 19 228 0; #X text 516 231 22K; #X text 270 261 <- reset gain; #X text 224 148 GAIN; #X text 21 24 Using Fourier resynthesis you can take an incoming sound , operate on its spectrum , and hear the result. Here we start with white noise and apply a frequency-dependent gain , which works as a graphic equalizer. There are N/2 = 256 points , each spaced SR/512 Hz. apart (although their frequency ranges overlap). Open the "fft-analysis" patch to see the workings.; #X connect 0 0 3 0; #X connect 0 0 3 1; #X connect 4 0 0 0; #X connect 6 0 7 0;
--- NEW FILE: H16.adsr.filter.qlist.pd --- #N canvas 131 52 921 585 12; #X obj 12 219 r trigger; #X obj 12 437 *~; #X obj 12 330 *~ 0.01; #X obj 12 365 *~; #X obj 12 395 *~; #X obj 59 359 r pitch; #X obj 59 409 mtof; #X floatatom 59 384 4 0 0 0 - - -; #X floatatom 36 271 4 0 0 0 - - -; #X obj 36 246 r level; #X floatatom 110 271 4 0 0 0 - - -; #X obj 110 246 r attack; #X floatatom 195 271 4 0 0 0 - - -; #X obj 195 246 r decay; #X floatatom 270 271 4 0 0 0 - - -; #X floatatom 364 271 4 0 0 0 - - -; #X obj 270 246 r sustain; #X obj 364 246 r release; #X obj 499 158 r note; #X msg 500 236 ; trigger 1; #X obj 602 225 del; #X msg 602 247 ; trigger 0; #X obj 14 166 qlist; #X obj 14 7 r qlist; #X msg 35 34 bang; #X msg 35 59 rewind; #X obj 42 88 r tempo; #X floatatom 42 113 4 0 0 0 - - -; #X msg 42 138 tempo $1; #X obj 499 201 t b f; #X obj 550 198 s pitch; #X obj 624 176 r duration; #X floatatom 624 201 4 0 0 0 - - -; #X floatatom 499 181 4 0 0 0 - - -; #X obj 268 319 r trigger; #X floatatom 294 375 4 0 0 0 - - -; #X floatatom 366 405 4 0 0 0 - - -; #X floatatom 456 405 4 0 0 0 - - -; #X floatatom 542 405 4 0 0 0 - - -; #X floatatom 638 405 4 0 0 0 - - -; #X obj 294 350 r level2; #X obj 366 380 r attack2; #X obj 456 380 r decay2; #X obj 542 380 r sustain2; #X obj 638 380 r release2; #X obj 59 434 tabosc4~ array1; #X floatatom 218 365 4 0 0 0 - - -; #X obj 12 481 vcf~; #X floatatom 119 487 4 0 0 0 - - -; #X obj 119 462 r q; #X obj 12 305 adsr 0 0 0 0 0; #X obj 268 443 adsr 0 0 0 0 0; #X obj 294 400 / 69.23; #X obj 218 390 mtof; #X obj 218 415 sqrt; #X obj 218 440 sqrt; #X obj 176 335 r filter; #X obj 219 493 *~; #X obj 219 518 *~; #X obj 268 468 +~ 1; #X obj 218 465 *~; #X text 118 214 ADSR for amplitude:; #N canvas 0 258 703 380 otherstuff 0; #X obj 289 86 loadbang; #X obj 418 85 loadbang; #N canvas 0 0 450 300 graph2 0; #X array array1 67 float 1; #A 0 0 0 0 0 0.714286 0.742857 0.757143 0.771429 0.778571 0.785714 0.785714 0.785714 0.785714 0.790476 0.795238 0.614286 0.585714 0.442857 0.271429 -0.128571 -0.142857 -0.157143 -0.171429 -0.642857 -0.528571 -0.614286 -0.685714 -0.828571 -0.828571 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.557143 0.571429 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; #X coords 0 1 66 -1 200 140 1; #X restore 62 81 graph; #X msg 418 115 ; qlist read qlist2.txt; #X msg 289 111 ; level 100 ; attack 20 ; decay 300 ; sustain 70 ; release 300 ; duration 300 ; pitch 72 ; filter 38 ; level2 49 ; attack2 19 ; decay2 300 ; sustain2 17 ; release2 700 ; q 3 ; tempo 4; #X connect 0 0 4 0; #X connect 1 0 3 0; #X restore 134 560 pd otherstuff; #X text 87 33 <--start loop; #X text 104 61 <--stop loop; #X text 90 113 <--set tempo; #X text 257 562 <--loadbangs and table; #X msg 447 517 ; qlist read qlist2.txt; #X text 441 493 click to reload qlist2.txt; #X obj 12 509 output~; #X text 229 19 This is an analog-synth sound made using a wavetable oscillator and a "vcf~' object. Unkike the "floyd" example earlier , we use a qlist object to do the sequencing. This can also be adapted to make a keyboard synth.; #X text 227 85 The qlist reads the file , "qlist2.txt" , which contains four "note" messages and a message at the end that restarts the qlist at the beginning. The "note" messages are translated into a pitch change and triggers for the ADSRs.; #X text 667 551 updated for Pd version 0.39; #X text 379 305 ADSR for filter. Here , it works better to make the envelope modify a constant "filter pitch"--so the "filter" receive gets the "mtof" treatment and the ADSR is an offset in halftones.; #X text 231 1 ANALOG_STYLE SYNTH USING QLIST; #X connect 0 0 50 0; #X connect 1 0 47 0; #X connect 2 0 3 0; #X connect 2 0 3 1; #X connect 3 0 4 0; #X connect 3 0 4 1; #X connect 4 0 1 0; #X connect 5 0 7 0; #X connect 6 0 45 0; #X connect 7 0 6 0; #X connect 8 0 50 1; #X connect 9 0 8 0; #X connect 10 0 50 2; #X connect 11 0 10 0; #X connect 12 0 50 3; #X connect 13 0 12 0; #X connect 14 0 50 4; #X connect 15 0 50 5; #X connect 16 0 14 0; #X connect 17 0 15 0; #X connect 18 0 33 0; #X connect 20 0 21 0; #X connect 23 0 22 0; #X connect 24 0 22 0; #X connect 25 0 22 0; #X connect 26 0 27 0; #X connect 27 0 28 0; #X connect 28 0 22 0; #X connect 29 0 20 0; #X connect 29 0 19 0; #X connect 29 1 30 0; #X connect 31 0 32 0; #X connect 32 0 20 1; #X connect 33 0 29 0; #X connect 34 0 51 0; #X connect 35 0 52 0; #X connect 36 0 51 2; #X connect 37 0 51 3; #X connect 38 0 51 4; #X connect 39 0 51 5; #X connect 40 0 35 0; #X connect 41 0 36 0; #X connect 42 0 37 0; #X connect 43 0 38 0; #X connect 44 0 39 0; #X connect 45 0 1 1; #X connect 46 0 53 0; #X connect 47 0 69 0; #X connect 47 0 69 1; #X connect 48 0 47 2; #X connect 49 0 48 0; #X connect 50 0 2 0; #X connect 51 0 59 0; #X connect 52 0 51 1; #X connect 53 0 54 0; #X connect 54 0 55 0; #X connect 55 0 60 0; #X connect 56 0 46 0; #X connect 57 0 58 0; #X connect 57 0 58 1; #X connect 58 0 47 1; #X connect 59 0 60 1; #X connect 60 0 57 0; #X connect 60 0 57 1;
--- NEW FILE: D13.additive.qlist.pd --- #N canvas 233 179 667 449 12; #X obj 16 182 osc-voice amp1 pit1; #X obj 16 206 osc-voice amp2 pit2; #X obj 16 230 osc-voice amp3 pit3; #X obj 16 254 osc-voice amp4 pit4; #X obj 16 278 osc-voice amp5 pit5; #X obj 16 302 osc-voice amp6 pit6; #X obj 16 326 osc-voice amp7 pit7; #X obj 16 350 osc-voice amp8 pit8; #X obj 464 343 qlist; #X msg 394 185 stop; #X msg 524 300 read qlist.txt; #X obj 524 255 loadbang; #X text 258 164 start; #X text 395 161 stop; #X text 534 279 reread file; #X msg 467 199 rewind; #X msg 535 199 next; #X msg 251 212 tempo 100 , bang; #X msg 250 188 tempo 1 , bang; #X text 82 11 USING QLIST TO SEQUENCE AN OSCILLATOR BANK; #X text 479 178 single step; #X obj 532 392 r #; #X text 28 49 Here is an eight voice additive synthesis patch controlled by a qlist. Open a text editor on the file , "qlist.txt" , to see how the oscillators' amplitudes and frequencies are specified. The abstraction , "osc-voice" , shows an effective way to make patches react to qlists but also to mousing.; #X text 234 391 this is where qlist comments go:; #X obj 16 380 output~; #X text 394 423 updatged for Pd version 0.39; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 7 0 24 0; #X connect 7 0 24 1; #X connect 9 0 8 0; #X connect 10 0 8 0; #X connect 11 0 10 0; #X connect 15 0 8 0; #X connect 16 0 8 0; #X connect 17 0 8 0; #X connect 18 0 8 0;
--- NEW FILE: I10.phase.bash.pd --- #N canvas 165 311 718 552 12; #X floatatom 407 323 0 0 0 0 - - -; #N canvas 122 165 801 538 fft 0; #X obj 39 153 *~; #X obj 7 153 *~; #X obj 7 98 *~; #X obj 7 70 inlet~; #X obj 7 125 rfft~; #X obj 7 227 *~; #X obj 7 306 rifft~; #X obj 43 99 tabreceive~ $0-hann; #X obj 7 200 q8_sqrt~; #X obj 337 158 samplerate~; #X obj 328 124 bang~; #X obj 337 183 t f b; #X obj 444 4 loadbang; #X obj 636 19 r window-size; #X obj 636 65 block~; #X obj 337 207 osc~; #X msg 381 207 0; #X obj 8 333 *~; #X obj 44 334 tabreceive~ $0-hann; #X obj 9 363 outlet~; #X obj 77 281 r window-size; #X obj 7 281 /~ 1000; #X msg 636 41 set $1 2; #X obj 387 267 r $0-start; #X obj 328 320 spigot; #X msg 387 292 1; #X msg 354 292 0; #X obj 328 516 outlet; #X obj 364 372 r window-size; #X obj 364 441 t f b; #X obj 396 464 samplerate~; #X obj 364 464 /; #X obj 364 487 * 1000; #X obj 328 493 del; #X obj 364 395 / 2; #X obj 364 418 - 1; #X msg 443 28 ; pd dsp 1 ; window-size 1024 ; pitch 48 ; specshift 0; #X text 96 196 magnitude of FT; #X text 18 249 align partials to middle of window; #X text 39 232 alternate every other sign to; #X text 383 122 control computations to do every frame; #X text 414 180 set sample rate of the oscillator to; #X text 416 195 Nyquist (here we're operating at twice; #X text 418 211 the global "samplerate~" because of; #X text 417 228 the overlap-2 blocking.) Also set phase; #X text 417 244 to zero at beginning of frame.; #X text 424 287 When analysis starts , set a delay to; #X text 425 304 one frame minus a sample (i.e. , just; #X text 424 321 one 64-sample block before the next; #X text 423 338 frame) which is synchronized with the; #X text 423 352 first frame emerging from outlet~ at; #X text 499 368 left. In the parent window; #X text 497 385 this is used to start; #X text 497 402 recording synchronously.; #X text 14 384 output phase-aligned frames; #X text 395 514 output a bang to start recording; #X connect 0 0 8 0; #X connect 1 0 8 0; #X connect 2 0 4 0; #X connect 3 0 2 0; #X connect 4 0 1 0; #X connect 4 0 1 1; #X connect 4 1 0 0; #X connect 4 1 0 1; #X connect 5 0 21 0; #X connect 6 0 17 0; #X connect 7 0 2 1; #X connect 8 0 5 0; #X connect 9 0 11 0; #X connect 10 0 9 0; #X connect 10 0 24 0; #X connect 11 0 15 0; #X connect 11 1 16 0; #X connect 12 0 36 0; #X connect 13 0 22 0; #X connect 15 0 5 1; #X connect 16 0 15 1; #X connect 17 0 19 0; #X connect 18 0 17 1; #X connect 20 0 21 1; #X connect 21 0 6 0; #X connect 22 0 14 0; #X connect 23 0 25 0; #X connect 24 0 26 0; #X connect 24 0 33 0; #X connect 25 0 24 1; #X connect 26 0 24 1; #X connect 28 0 34 0; #X connect 29 0 31 0; #X connect 29 1 30 0; #X connect 30 0 31 1; #X connect 31 0 32 0; #X connect 32 0 33 1; #X connect 33 0 27 0; #X connect 34 0 35 0; #X connect 35 0 29 0; #X restore 22 459 pd fft; #X floatatom 586 377 0 0 120 0 - pitch-set -; #X floatatom 583 330 0 0 0 0 - specshift-set -; #X obj 583 353 s specshift; #X obj 407 443 s loco; #X obj 586 400 s pitch; #X obj 407 346 pack 0 100; #X obj 588 453 output~; #X text 214 -1 PHASE BASHING; #X text 455 515 updated for Pd version 0.39; #X floatatom 199 389 5 0 0 0 - #0-samp-msec -; #X text 197 403 sample length , msec; #X msg 198 288 ../sound/bell.aiff; #X msg 198 313 ../sound/voice.wav; #X msg 198 338 ../sound/voice2.wav; #X text 201 266 change input sound; #X obj 198 364 s read-sample; #N canvas 190 43 657 626 test-signal 0; #X obj 88 381 line~; #X obj 88 306 f; #X obj 88 536 outlet~; #X msg 88 360 0 , $1 $2; #X obj 88 334 pack 0 0; #X obj 190 303 /; #X obj 269 283 * 0.001; #X obj 211 260 t b b f; #X obj 152 225 t b f; #X obj 88 406 tabread4~ $0-sample; #X obj 286 391 adc~ 1; #X obj 414 280 inlet; #X obj 454 339 samplerate~; #X obj 151 201 r $0-samplength; #X obj 211 234 r $0-insamprate; #X obj 87 189 inlet; #X obj 454 363 s $0-insamprate; #X obj 285 423 *~; #X obj 363 380 del; #X obj 414 312 t b b; #X msg 402 379 1; #X msg 401 404 0; #X obj 87 473 hip~ 5; #X obj 88 444 +~; #X text 73 123 play sample; #X text 71 143 once; #X obj 482 420 s $0-start; #X connect 0 0 9 0; #X connect 1 0 4 0; #X connect 3 0 0 0; #X connect 4 0 3 0; #X connect 5 0 4 1; #X connect 5 0 18 1; #X connect 6 0 5 1; #X connect 7 1 5 0; #X connect 7 2 6 0; #X connect 8 1 5 0; #X connect 8 1 1 1; #X connect 9 0 23 0; #X connect 10 0 17 0; #X connect 11 0 19 0; #X connect 12 0 16 0; #X connect 13 0 8 0; #X connect 14 0 7 0; #X connect 15 0 1 0; #X connect 15 0 26 0; #X connect 17 0 23 1; #X connect 18 0 21 0; #X connect 19 0 20 0; #X connect 19 0 18 0; #X connect 19 0 26 0; #X connect 19 1 12 0; #X connect 20 0 17 1; #X connect 21 0 17 1; #X connect 22 0 2 0; #X connect 23 0 22 0; #X restore 22 436 pd test-signal; #X obj 143 417 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #N canvas 0 110 565 454 hann-window 0; #N canvas 0 0 450 300 graph1 0; #X array $0-hann 2048 float 0; #X coords 0 1 2047 0 300 100 1; #X restore 82 311 graph; #X obj 378 165 osc~; #X obj 378 190 *~ -0.5; #X obj 378 214 +~ 0.5; #X obj 331 247 tabwrite~ $0-hann; #X obj 37 88 r window-size; #X obj 38 173 /; #X obj 127 142 samplerate~; #X obj 38 251 s window-sec; #X obj 177 204 swap; #X obj 177 228 /; #X obj 177 252 s window-hz; #X obj 49 201 * 1000; #X obj 49 228 s window-msec; #X obj 38 115 t f b f; #X msg 173 92 resize $1; #X obj 173 116 s $0-hann; #X obj 330 105 r window-hz; #X msg 382 130 0; #X obj 330 131 t f b; #X text 15 8 calculate Hann window table (variable window size) and constants window-hz (fundamental frequency of analysis) , window-sec and window-msec (analysis window size in seconds and msec).; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 5 0 14 0; #X connect 6 0 8 0; #X connect 6 0 12 0; #X connect 7 0 6 1; #X connect 7 0 9 1; #X connect 9 0 10 0; #X connect 9 1 10 1; #X connect 10 0 11 0; #X connect 12 0 13 0; #X connect 14 0 6 0; #X connect 14 0 9 0; #X connect 14 1 7 0; #X connect 14 2 15 0; #X connect 15 0 16 0; #X connect 17 0 19 0; #X connect 18 0 1 1; #X connect 19 0 1 0; #X connect 19 1 4 0; #X connect 19 1 18 0; #X restore 195 441 pd hann-window; #X msg 28 269 512; #X msg 28 290 1024; #X msg 28 312 2048; #X obj 28 357 s window-size; #X msg 28 334 4096; #N canvas 388 86 736 499 insample 0; #N canvas 0 0 450 300 graph1 0; #X array $0-sample 62079 float 0; #X coords 0 1 62078 -1 400 150 1; #X restore 259 24 graph; #X obj 19 23 r read-sample; #X obj 19 74 unpack s f; #X obj 19 184 soundfiler; #X text 118 379 read a sample; #X obj 38 378 loadbang; #X obj 19 100 t s b; #X obj 75 99 symbol $0-sample; #X obj 19 135 pack s s; #X msg 19 160 read -resize $1 $2; #X obj 74 46 44100; #X obj 19 47 t a b; #X obj 29 208 s $0-samplength; #X obj 116 74 s $0-insamprate; #X obj 19 281 /; #X obj 19 305 * 1000; #X obj 19 328 s $0-samp-msec; #X obj 57 281 r $0-insamprate; #X msg 38 402 ; read-sample ../sound/voice.wav; #N canvas 0 0 450 300 graph1 0; #X array $0-nophase 62079 float 0; #X coords 0 1 62078 -1 400 150 1; #X restore 256 185 graph; #X msg 376 403 resize $1; #X obj 376 379 r $0-samplength; #X obj 376 428 s $0-nophase; #X connect 1 0 11 0; #X connect 2 0 6 0; #X connect 2 1 13 0; #X connect 3 0 12 0; #X connect 3 0 14 0; #X connect 5 0 18 0; #X connect 6 0 8 0; #X connect 6 1 7 0; #X connect 7 0 8 1; #X connect 8 0 9 0; #X connect 9 0 3 0; #X connect 10 0 13 0; #X connect 11 0 2 0; #X connect 11 1 10 0; #X connect 14 0 15 0; #X connect 15 0 16 0; #X connect 17 0 14 1; #X connect 20 0 22 0; #X connect 21 0 20 0; #X restore 195 464 pd insample; #X obj 22 416 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 33 384 ---analyze---; #X text 20 399 sample; #X obj 94 489 tabwrite~ $0-nophase; #X obj 21 492 output~; #X msg 415 384 0 , 400 4000; #X msg 415 419 0 , 400 10000; #X text 47 18 This patch takes an incoming sound , does an overlap-2 FFT analysis of it , and bashes the phases of the spectra so that when regenerated the components will all have zero phase at the middle of each window. You can use the windows as waveforms and cross-fade them at will without getting phase modulation. This might be useful for making synthetic instruments that mimic the spectral variation of recorded sounds.; #X text 398 305 (hundredths of sec); #X text 401 289 location in sample; #X text 420 365 normal speed; #X text 422 403 slow; #X text 458 262 ------ playback -------; #N canvas 81 424 887 624 playback 0; #X obj 101 479 r invblk; #X obj 28 499 *~; #X obj 61 501 clip~ 1 1000; #X floatatom 38 89 0 0 0 0 - - -; #X floatatom 510 93 0 0 0 0 - - -; #X obj 496 392 *~; #X obj 626 369 samphold~; #X obj 733 369 samphold~; #X obj 538 369 samphold~; #X obj 481 500 clip~ -0.5 0.5; #X obj 481 523 cos~; #X obj 651 427 +~; #X obj 653 506 -~; #X obj 642 533 *~; #X obj 642 558 +~; #X obj 621 582 *~; #X obj 40 408 *~; #X obj 197 362 samphold~; #X obj 302 367 samphold~; #X obj 508 290 phasor~; #X obj 174 288 wrap~; #X obj 510 68 r pitch; #X obj 510 140 mtof; #X obj 269 199 line~; #X obj 268 224 -~; #X text 8 42 spectral stretch; #X obj 89 367 samphold~; #X obj 665 187 t b f; #X obj 699 210 /; #X obj 665 209 1; #X obj 29 524 clip~ -0.5 0.5; #X obj 29 546 cos~; #X obj 211 425 +~; #X obj 212 505 -~; #X obj 194 526 *~; #X obj 201 549 +~; #X text 45 426 offset into; #X text 50 440 sample; #X text 368 169 samples; #X text 368 154 period in; #X text 204 378 weight for; #X text 204 393 next block; #X obj 760 312 wrap~; #X obj 700 232 s invblk; #X obj 558 453 r invblk; #X obj 665 138 r window-size; #X obj 38 65 r specshift; #X obj 261 64 r loco; #X obj 482 473 *~; #X obj 518 474 clip~ 1 1000; #X obj 510 117 - 12; #X obj 38 136 + 69; #X obj 38 159 mtof; #X obj 38 182 / 440; #X obj 28 284 *~ 1; #X obj 760 287 +~ 0.5; #X obj 60 479 *~ 1; #X obj 518 453 *~ 1; #X obj 481 545 +~ 1; #X obj 29 569 +~ 1; #X obj 267 292 *~ 1; #X obj 212 453 +~ 0; #X obj 652 456 +~ 0; #X obj 28 366 -~ 0.5; #X obj 479 369 -~ 0.5; #X obj 286 603 outlet~; #X obj 212 479 tabread4~ $0-nophase; #X obj 249 504 tabread4~ $0-nophase; #X obj 652 480 tabread4~ $0-nophase; #X obj 688 505 tabread4~ $0-nophase; #X obj 268 247 +~ 0.5; #X text 60 248 grain size; #X text 62 264 in samples; #X text 97 383 grain size; #X text 311 389 middle; #X text 311 404 of block; #X text 165 248 fractional; #X text 164 265 part of loc; #X text 295 224 integer part of loc; #X text 328 247 middle of block; #X text 310 290 cvt to samples; #X text 522 265 run two copies 180 degrees out of phase; #X text 29 589 window shaped; #X text 27 604 by raised cos; #X text 265 522 weighted sum of; #X text 265 538 2 windows; #X obj 180 573 *~; #X obj 286 577 +~; #X obj 704 163 s blksize; #X obj 683 429 r blksize; #X obj 243 427 r blksize; #X obj 297 270 r blksize; #X obj 665 162 / 2; #X obj 366 132 /; #X obj 366 105 samplerate~; #X obj 365 82 t b f; #X obj 38 112 * 0.125; #X text 223 44 read location in sec/100; #X obj 200 120 samplerate~; #X obj 167 72 / 100; #X obj 167 96 t f b; #X obj 167 119 *; #X obj 200 144 r blksize; #X obj 167 144 /; #X text 113 162 read location , blocks; #X obj 260 89 unpack; #X msg 630 52 set $1; #X obj 771 32 r pitch; #X msg 771 55 set $1; #X obj 630 30 r specshift; #X text 723 190 1/(block size); #X obj 630 76 s specshift-set; #X obj 770 78 s pitch-set; #X text 607 104 analysis overlap was 2 so our; #X text 606 120 block size is (window size)/2; #X text 12 -1 OVERLAPPED , WINDOWED SAMPLE PLAYBACK; #X text 357 0 - with controls for pitch , location , and spectral shift; #X connect 0 0 56 1; #X connect 1 0 30 0; #X connect 2 0 1 1; #X connect 3 0 96 0; #X connect 4 0 50 0; #X connect 5 0 11 0; #X connect 6 0 13 0; #X connect 7 0 11 1; #X connect 8 0 5 1; #X connect 8 0 57 0; #X connect 9 0 10 0; #X connect 10 0 58 0; #X connect 11 0 62 0; #X connect 11 0 69 0; #X connect 12 0 13 1; #X connect 13 0 14 0; #X connect 14 0 15 1; #X connect 15 0 87 1; #X connect 16 0 32 0; #X connect 17 0 34 0; #X connect 18 0 32 1; #X connect 19 0 26 1; #X connect 19 0 18 1; #X connect 19 0 17 1; #X connect 19 0 55 0; #X connect 19 0 63 0; #X connect 20 0 24 1; #X connect 20 0 17 0; #X connect 20 0 6 0; #X connect 21 0 4 0; #X connect 22 0 19 0; #X connect 22 0 95 0; #X connect 23 0 20 0; #X connect 23 0 24 0; #X connect 24 0 70 0; #X connect 26 0 16 1; #X connect 26 0 56 0; #X connect 27 0 29 0; #X connect 27 1 28 1; #X connect 28 0 43 0; #X connect 29 0 28 0; #X connect 30 0 31 0; #X connect 31 0 59 0; #X connect 32 0 61 0; #X connect 32 0 67 0; #X connect 33 0 34 1; #X connect 34 0 35 0; #X connect 35 0 86 1; #X connect 42 0 8 1; #X connect 42 0 6 1; #X connect 42 0 7 1; #X connect 42 0 64 0; #X connect 44 0 57 1; #X connect 45 0 92 0; #X connect 46 0 3 0; #X connect 47 0 105 0; #X connect 48 0 9 0; #X connect 49 0 48 1; #X connect 50 0 22 0; #X connect 51 0 52 0; #X connect 52 0 53 0; #X connect 53 0 54 1; #X connect 54 0 26 0; #X connect 54 0 8 0; #X connect 55 0 42 0; #X connect 56 0 2 0; #X connect 57 0 49 0; #X connect 58 0 15 0; #X connect 59 0 86 0; #X connect 60 0 18 0; #X connect 60 0 7 0; #X connect 61 0 66 0; #X connect 62 0 68 0; #X connect 63 0 16 0; #X connect 63 0 1 0; #X connect 64 0 5 0; #X connect 64 0 48 0; #X connect 66 0 33 0; #X connect 67 0 33 1; #X connect 67 0 35 1; #X connect 68 0 12 0; #X connect 69 0 12 1; #X connect 69 0 14 1; #X connect 70 0 60 0; #X connect 86 0 87 0; #X connect 87 0 65 0; #X connect 89 0 62 1; #X connect 90 0 61 1; #X connect 91 0 60 1; #X connect 92 0 88 0; #X connect 92 0 27 0; #X connect 93 0 54 0; #X connect 94 0 93 0; #X connect 95 0 94 0; #X connect 95 1 93 1; #X connect 96 0 51 0; #X connect 98 0 101 1; #X connect 99 0 100 0; #X connect 100 0 101 0; #X connect 100 1 98 0; #X connect 101 0 103 0; #X connect 102 0 103 1; #X connect 103 0 23 0; #X connect 105 0 99 0; #X connect 105 1 23 1; #X connect 106 0 111 0; #X connect 107 0 108 0; #X connect 108 0 112 0; #X connect 109 0 106 0; #X restore 589 428 pd playback; #X text 585 290 spectral shift; #X text 583 306 (hundredths of; #X text 646 323 octave); #X text 126 398 live; #X text 45 141 You can save the analyses and needn't be running the FFT patch to do the resynthesis. You can read a sample , select window size , and press "sample" to analyze it , or else analyze a "live" input. You'll hear the phase-bashed sample as the analysis runs. You can regenerate the sound with specified pitch , sample location , and spectral shift , using the "playback" controls.; #X text 83 278 analysis; #X text 80 264 (redo; #X text 83 294 after; #X text 84 309 changing; #X text 84 325 window; #X text 85 339 size); #X connect 0 0 7 0; #X connect 1 0 30 0; #X connect 1 0 31 0; #X connect 1 0 31 1; #X connect 1 1 30 0; #X connect 2 0 6 0; #X connect 3 0 4 0; #X connect 7 0 5 0; #X connect 13 0 17 0; #X connect 14 0 17 0; #X connect 15 0 17 0; #X connect 18 0 1 0; #X connect 19 0 18 1; #X connect 21 0 24 0; #X connect 22 0 24 0; #X connect 23 0 24 0; #X connect 25 0 24 0; #X connect 27 0 18 0; #X connect 32 0 5 0; #X connect 33 0 5 0; #X connect 40 0 8 0; #X connect 40 0 8 1;
--- NEW FILE: J05.triangle.pd --- #N canvas 111 30 606 531 12; #N canvas 0 0 450 300 graph1 0; #X array $0-sum 882 float 0; #X coords 0 0.5 881 -0.5 200 130 1; #X restore 382 119 graph; #X text 381 257 ---- 0.02 seconds ----; #X text 350 505 updated for Pd version 0.39; #X obj 46 242 output~; #X obj 140 276 tabwrite~ $0-sum; #X obj 130 107 / 100; #X floatatom 130 86 4 0 100 0 - - -; #X obj 206 108 / 100; #X floatatom 206 87 4 0 100 0 - - -; #X obj 151 228 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; #X obj 151 250 metro 193; #X obj 19 95 phasor~; #X floatatom 19 74 5 0 0 0 - - -; #X text 11 51 frequency; #X text 126 50 SLOPES (percent); #X obj 108 137 *~; #X obj 19 129 *~ -1; #X obj 19 154 +~ 1; #X obj 184 156 *~; #X obj 108 189 min~; #X text 341 118 0.5; #X text 338 237 -0.5; #X text 30 4 Making waveforms with corners by specifying line segment slopes; #X text 136 67 up; #X text 209 68 down; #X text 29 317 Occasionally a second method for making corners is more convenient. Here we specify the slopes of the rising and falling segments (as always , in units per cycle). We then make a triangle wave with a corner at (0 , 0) and another one , placed somewhere within the cycle. The slopes of the two lines determine the second point , which will have an x value of t/(s+t) (if we let s denote the rising slope and t the falling one , both as positive numbers). The y value is st/(s+t). If we wish instead to specify the corner location (x , y) (with x in cycles , 0<x<1) we set s = y/x and t = y/(1-x). The DC value is y/2.; #X connect 5 0 15 1; #X connect 6 0 5 0; #X connect 7 0 18 1; #X connect 8 0 7 0; #X connect 9 0 10 0; #X connect 10 0 4 0; #X connect 11 0 15 0; #X connect 11 0 16 0; #X connect 12 0 11 0; #X connect 15 0 19 0; #X connect 16 0 17 0; #X connect 17 0 18 0; #X connect 18 0 19 1; #X connect 19 0 3 0; #X connect 19 0 4 0;
--- NEW FILE: H06.envelope.follower.pd --- #N canvas 87 74 585 621 12; #X floatatom 354 464 4 0 0 0 - - -; #X floatatom 150 316 3 0 999 0 - #0-osc2 -; #X obj 150 336 osc~; #X text 162 12 ENVELOPE FOLLOWER; #X text 22 33 An envelope follower measures the mean square power of an signal as it changes over time. (You can convert mean square power to RMS ampitude or to decibels if you wish.) The term "mean square" means simply that the signal should be squared , and then averaged. The averageing is done using a low-pass filter such as lop~.; #X obj 62 466 lop~; #X floatatom 93 444 3 0 100 0 - #0-lop -; #X obj 61 356 +~; #X text 187 317 <-- frequency of second oscillator; #X obj 62 330 osc~ 500; #X obj 62 413 *~; #X obj 62 522 snapshot~; #X floatatom 62 573 5 0 999 0 - - -; #X obj 62 545 sqrt; #X text 335 361 built-in envelope; #X obj 354 491 dbtorms; #X floatatom 354 518 5 0 999 0 - - -; #N canvas 536 459 382 265 startup 0; #X obj 22 24 loadbang; #X obj 22 48 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 22 67 f $0; #X text 35 195 This subpatch loads initial; #X text 31 219 values in number boxes.; #X msg 22 91 ; $1-osc2 400 ; $1-lop 10 ; $1-metro 1 ; pd dsp 1; #X obj 223 132 metro 250; #X obj 223 107 r $0-metro; #X obj 223 156 s $0-tick; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 5 0; #X connect 6 0 8 0; #X connect 7 0 6 0; #X restore 217 598 pd startup; #X text 115 414 square the signal; #X text 124 440 <-- responsiveness; #X text 159 501 take snapshot; #X text 108 548 convert to RMS; #X text 327 599 updated for Pd version 0.39; #X text 334 381 follower for comparison; #X text 107 466 low-pass filter; #X text 114 573 output; #X obj 70 497 r $0-tick; #X text 159 517 every 1/4 second; #X obj 389 439 r $0-tick; #X obj 354 439 f; #X obj 376 414 env~; #X text 20 242 The env~ object at right , which is a built-in envelope follower using a higher-quality low-pass filter than lop~ , is shown for comparison. Its output is artificially slowed down to match the homemade one at left.; #X obj 150 359 *~; #X obj 185 360 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 204 358 <-- on/off; #X text 20 128 Here we're adding two oscillators so the result should be an RMS of one if the second oscillator is on , 0.707 otherwise. Note two effects: first , the more responsive the envelope follower , the less accurate the result (but the faster it responds). Second , if the two oscillators are tuned close to each other their beating affects the nombers coming out.; #X connect 0 0 15 0; #X connect 1 0 2 0; #X connect 2 0 32 0; #X connect 5 0 11 0; #X connect 6 0 5 1; #X connect 7 0 10 0; #X connect 7 0 10 1; #X connect 7 0 30 0; #X connect 9 0 7 0; #X connect 10 0 5 0; #X connect 11 0 13 0; #X connect 13 0 12 0; #X connect 15 0 16 0; #X connect 26 0 11 0; #X connect 28 0 29 0; #X connect 29 0 0 0; #X connect 30 0 29 1; #X connect 32 0 7 1; #X connect 33 0 32 1;