#N canvas 425 55 707 760 12;
#X declare -stdpath ./;
#X obj 475 555 print didit;
#X floatatom 93 550 6 0 0 0 - - - 0;
#X msg 187 446 print;
#X obj 96 725 soundfiler;
#X text 17 724 see also:;
#X obj 33 11 readsf~;
#X obj 150 516 output~;
#X obj 185 725 writesf~;
#X obj 475 525 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 534 356 declare -stdpath ./;
#X obj 3 41 cnv 1 695 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 623 10 <= click;
#N canvas 651 73 586 410 reference 0;
#X obj 8 52 cnv 5 565 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 8 208 cnv 2 565 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 8 309 cnv 2 565 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 7 383 cnv 5 565 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 7 273 cnv 1 565 1 empty empty rightmost: 8 12 0 13 #7c7c7c #000000 0;
#X obj 7 236 cnv 1 565 1 empty empty n: 8 12 0 13 #7c7c7c #000000 0;
#X obj 30 18 readsf~;
#X text 78 66 open <list> -;
#X text 120 155 float -;
#X text 177 155 nonzero starts playback \, zero stops., f 54;
#X text 121 176 print - prints information on Pd's terminal window., f 62;
#X text 122 245 signal -;
#X text 187 245 channel output of a given file., f 46;
#X text 137 281 bang - when finishing playing file., f 54;
#X text 86 332 1) float - sets number of output channels (default 1 \, max 64)., f 62;
#X text 82 213 ('n' number of outlets specified by argument);
#X text 120 115 start -;
#X text 127 135 stop -;
#X text 177 135 stop playback., f 54;
#X text 88 19 - soundfile playback from disk.;
#X text 177 115 start playback., f 54;
#X text 86 351 2) float - per channel buffer size in bytes (default/min 262144)., f 65;
#X text 177 66 (needed before start playback) sets a filename and optionally: samples onset \, header size to skip \, number of channels \, bytes per sample \, and endianness., f 54;
#X restore 529 11 pd reference;
#X floatatom 284 550 6 0 0 0 - - - 0;
#X text 502 466 Arguments:, f 20;
#X obj 144 386 tgl 19 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X floatatom 144 413 3 0 0 0 - - - 0;
#X text 167 386 nonzero starts playback \, zero stops it;
#X msg 120 325 start;
#X msg 132 355 stop;
#X text 165 325 start playback;
#X text 171 355 stop playback;
#X text 91 11 - soundfile playback from disk;
#X obj 3 713 cnv 1 695 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 93 523 env~;
#X obj 284 523 env~;
#X text 348 518 "bang" when file reaches the end., f 16;
#X msg 93 295 open ../sound/bell.aiff 0 200 2 2 b;
#X msg 185 413 open ../sound/bell.aiff 22050 \, 1;
#X text 502 484 - number of channels - per channel buffer size in bytes, f 20;
#X obj 93 479 readsf~ 2 262144, f 55;
#X text 21 51 The [readsf~] object streams a soundfile from the hard disk. That is \, it doesn't fully load it into the memory \, but into a small local buffer first. The "open" message starts filling this buffer but a playback only starts when you send a "1" or "start" message. A "0" or "stop" message stops it. You may get audio dropouts if you "start" right after the "open" message \, so you should wait a few milliseconds between "open" and "start" to ensure that the buffer is filled in time. You can also increase the default buffer size as the 2nd argument \, but it shouldn't really be necessary. The 1st argument initializes the number of channel outputs., f 94;
#X text 425 405 open at half a second into the file and start right away. Since it's mono \, we only have the left output., f 35;
#X text 21 155 The 'wave' \, 'aiff' \, 'caf' \, and 'next' formats are supported \, although only uncompressed 2- or 3-byte integer ("pcm") and 4- or 8-byte floating point samples are accepted., f 94;
#X text 236 445 print info on Pd window;
#X text 40 593 NOTE: check also [soundfiler] \, which allows you to load a file into memory by filling it into an array. This also gives you more playback possibilities with table reading objects., f 89;
#X obj 258 725 openpanel;
#X text 21 189 HINT: The 'open' message can take "~" to define the home directory. Also note you can use [openpanel] to find sound files., f 94;
#X text 476 724 updated for Pd version 0.55-1;
#X text 40 643 ALSO NOTE: As of Pd 0.55-1 \, [readsf~]'s "open" method searches in the canvas environment \, just like [soundfiler] and similar objects. This means you can now use paths added via [declare] (which wasn't possible before)., f 89;
#X obj 30 268 openpanel;
#X msg 30 295 open \$1;
#X obj 30 239 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X text 352 286 (By overriding the header here \, we force this mono file to be played as a stereo twice as fast), f 41;
#X text 131 237 The open message takes filename and optionally: onset in samples \, header size to skip \, channels number \, bytes per sample and endianness.;
#X connect 2 0 30 0;
#X connect 8 0 0 0;
#X connect 15 0 16 0;
#X connect 16 0 30 0;
#X connect 18 0 30 0;
#X connect 19 0 30 0;
#X connect 24 0 1 0;
#X connect 25 0 13 0;
#X connect 27 0 30 0;
#X connect 28 0 30 0;
#X connect 30 0 6 0;
#X connect 30 0 24 0;
#X connect 30 1 25 0;
#X connect 30 1 6 1;
#X connect 30 2 8 0;
#X connect 40 0 41 0;
#X connect 41 0 30 0;
#X connect 42 0 40 0;
