#N canvas 425 55 711 715 12;
#X declare -stdpath ./;
#X obj 503 498 print didit;
#X floatatom 86 493 6 0 0 0 - - - 0;
#X msg 153 390 print;
#X obj 96 682 soundfiler;
#X text 17 681 see also:;
#X obj 33 11 readsf~;
#X obj 146 459 output~;
#X obj 185 682 writesf~;
#X obj 503 468 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 526 312 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 576 400 reference 0;
#X obj 8 52 cnv 5 550 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 8 208 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 8 309 cnv 2 550 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 7 383 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 7 273 cnv 1 550 1 empty empty rightmost: 8 12 0 13 #7c7c7c #000000 0;
#X obj 7 236 cnv 1 550 1 empty empty n: 8 12 0 13 #7c7c7c #000000 0;
#X obj 30 18 readsf~;
#X text 78 68 open <list> -;
#X text 120 157 float -;
#X text 177 157 nonzero starts playback \, zero stops., f 50;
#X text 121 178 print - prints information on Pd's terminal window., f 58;
#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 117 start -;
#X text 127 137 stop -;
#X text 177 137 stop playback., f 50;
#X text 88 19 - soundfile playback from disk.;
#X text 177 117 start playback., f 50;
#X text 177 68 sets a filename \, an onset in samples \, header size to skip \, number of channels \, bytes per sample \, and endianness. (needed before start playback.), f 50;
#X text 86 351 2) float - per channel buffer size in bytes (default/min 262144)., f 65;
#X restore 529 11 pd reference;
#X floatatom 294 493 6 0 0 0 - - - 0;
#X text 536 409 Arguments:, f 20;
#X obj 108 326 tgl 19 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X floatatom 108 353 3 0 0 0 - - - 0;
#X text 131 326 nonzero starts playback \, zero stops it;
#X msg 55 265 start;
#X msg 86 295 stop;
#X text 100 265 start playback;
#X text 125 295 stop playback;
#X text 91 11 - soundfile playback from disk;
#X text 291 229 Open takes: filename \, onset in samples \, header size to skip \, channels number \, bytes per sample and endianness., f 55;
#X obj 3 670 cnv 1 695 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 86 466 env~;
#X obj 294 466 env~;
#X text 291 262 (By overriding the header above \, we force this mono file to be played as a stereo twice as fast), f 55;
#X text 376 461 "bang" when file reaches the end., f 16;
#X msg 28 235 open ../sound/bell.aiff 0 200 2 2 b;
#X msg 149 355 open ../sound/bell.aiff 22050 \, 1;
#X text 536 427 - number of channels - per channel buffer size in bytes, f 20;
#X obj 86 422 readsf~ 2 262144, f 60;
#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 389 348 open at half a second into the file and start right away. Since it's mono \, we only have the left output., f 39;
#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 202 389 print info on Pd window;
#X text 40 548 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 682 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 681 updated for Pd version 0.55-1;
#X text 40 600 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 connect 2 0 32 0;
#X connect 8 0 0 0;
#X connect 15 0 16 0;
#X connect 16 0 32 0;
#X connect 18 0 32 0;
#X connect 19 0 32 0;
#X connect 25 0 1 0;
#X connect 26 0 13 0;
#X connect 29 0 32 0;
#X connect 30 0 32 0;
#X connect 32 0 6 0;
#X connect 32 0 25 0;
#X connect 32 1 26 0;
#X connect 32 1 6 1;
#X connect 32 2 8 0;
