/usr/lib/puredata/doc/3.audio.examples/I10.phase.bash.pd is in puredata-doc 0.43.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | #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;
|