max v2; #N vpatcher 4 45 1083 564; #P origin -17 0; #P window setfont Times 10.; #P comment 10 115 150 1310730 3. set grain length (window length); #P comment 661 58 150 1310730 2. Set grain length (window length); #P comment 512 67 78 1310730 signal vector size; #P comment 329 56 18 1310730 all; #P comment 329 79 30 1310730 speed; #P comment 395 60 46 1310730 startpoint; #P comment 210 60 41 1310730 panning; #P comment 214 28 234 1310730 Randomize starting point of each grain \, spatial panning of each grain \, and/or playback speed of each grain.; #P comment 65 257 73 1310730 3. Turn audio on; #P comment 571 157 125 1310730 *You can fill ubumenu with a list of available soundfiles for easy selection. Read about it in the manual to see how.; #P comment 335 118 96 1310730 detect the end of each window \, and trigger a bang for the next tick of the scheduler; #P comment 518 134 53 1310730 calculates a triangular window; #P comment 705 216 76 1310730 get the length of the sound in the buffer \, and use it to calculate the maximum safe location and duration of the grain window; #P comment 625 23 324 1310730 window length is specified in multiples of the signal vector size \, to insure that Max message information is always synchronzied with the beginning of a grain; #P comment 10 35 176 1310730 Play a single stream of grains from a pre-recorded sound \, using a triangular window; #P comment 10 157 207 1310730 5. open the gates to cause randomization of starting location of each grain \, spatial location of each grain \, and playback speed of each grain; #P comment 10 130 172 1310730 4. send a starting location to the groove~ object from the number box \, OR...; #P comment 10 100 73 1310730 2. turn audio on; #P comment 10 73 168 1310730 1. click on the message box containing the word "sound" to read in a sound file; #P comment 866 475 171 1310730 It also restores Max/MSP to its previous setting when the patch is closed.; #P comment 879 300 163 1310730 This puts the Max scheduler in "Audio Interrupt" (synchronizes the Max scheduler with the MSP callbacks).; #P comment 645 145 51 1310730 *ubumenu; #P window setfont "Fixedwidth Serif" 10.; #P newex 750 98 69 1441802 opendialog; #P message 750 78 39 1441802 sound; #P flonum 162 252 35 10 0. 1. 3 22 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 254 278 111 1441802 expr pow(2.\\\,$f1); #P newex 254 257 43 1441802 * 0.01; #P newex 254 236 39 1441802 - 100; #P newex 254 215 69 1441802 random 201; #P toggle 314 55 15 0; #P toggle 220 79 15 0; #P newex 220 184 33 1441802 gate; #P toggle 314 79 15 0; #P newex 314 184 33 1441802 gate; #P toggle 50 256 15 0; #P message 86 297 73 1441802 startwindow; #P message 50 297 33 1441802 stop; #P newex 119 359 66 1441802 dac~; #P newex 50 275 82 1441802 select 0 1; #P newex 162 230 43 1441802 * 0.01; #P newex 893 197 63 1441802 maximum 1; #P user ubumenu 505 50 42 1441802 0 1 1 0; #X add 1; #X add 2; #X add 4; #X add 8; #X add 16; #X add 32; #X add 64; #X add 128; #X add 256; #X add 512; #X add 1024; #X add 2048; #X add 4096; #X prefix_set 0 0 0; #P newex 505 28 93 1441802 adstatus sigvs; #P newex 162 209 69 1441802 random 101; #P newex 162 275 39 1441802 !- 1.; #P newex 218 296 33 1441802 sqrt; #P newex 162 296 33 1441802 sqrt; #P newex 175 334 53 1441802 *~ 0.707; #P newex 119 334 53 1441802 *~ 0.707; #P newex 781 218 46 1441802 t f f; #P newex 817 239 69 1441802 mstosamps~; #P newex 461 294 27 1441802 *~; #P flonum 374 209 59 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 374 228 51 1441802 sig~ 1.; #P number 428 230 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P toggle 408 79 15 0; #P newex 408 184 33 1441802 gate; #P newex 893 264 133 1441802 if $i1 > $i2 then $i2; #P newex 893 239 33 1441802 grab; #P newex 902 435 63 1441802 closebang; #P newex 902 456 114 1441802 i; #P message 964 407 14 1441802 1; #P message 985 407 14 1441802 0; #P newex 964 385 52 1441802 t b b i; #P newex 964 364 53 1441802 gate 1 1; #P newex 906 339 111 1441802 adstatus takeover; #P newex 448 115 27 1441802 - 1; #P newex 431 136 27 1441802 ==~; #P newex 431 159 39 1441802 edge~; #P newex 893 218 92 1441802 t b i i; #P message 934 240 43 1441802 max \$1; #P newex 893 151 39 1441802 t b i; #P newex 893 176 39 1441802 / 256; #P newex 374 253 103 1441802 groove~ source01; #P newex 626 77 39 1441802 t b f; #P newex 688 331 103 1441802 random; #P newex 812 285 39 1441802 t b f; #P newex 781 310 70 1441802 - 0.; #P newex 803 260 69 1441802 sampstoms~; #P newex 697 197 108 1441802 info~ source01; #P user ubumenu 652 128 100 1441802 0 1 1 0; #X add; #X types AIFF WAVE SDII; #X prefix_set 0 0 0; #P newex 697 151 103 1441802 prepend replace; #P newex 697 172 103 1441802 buffer~ source01; #P newex 588 127 33 1441802 >> 1; #P user scope~ 461 324 591 454 256 3 128 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0; #P number 626 58 35 10 1 344 3 22 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 588 102 77 1441802 * 1; #P newex 478 184 43 1441802 !-~ 1.; #P newex 478 161 33 1441802 abs~; #P newex 478 85 103 1441802 count~ 0 256 1 1; #P newex 478 115 27 1441802 -~; #P newex 478 138 40 1441802 *~; #P newex 508 115 39 1441802 !/ 1.; #P window setfont Times 10.; #P comment 789 79 99 1310730 1. Read in a sound file; #P connect 59 0 55 0; #P connect 55 0 57 0; #P connect 55 1 58 0; #P fasten 42 0 45 0 466 318 124 318; #P fasten 58 0 56 0 91 355 124 355; #P fasten 57 0 56 0 55 355 124 355; #P connect 45 0 56 0; #P fasten 62 0 50 0 225 205 167 205; #P connect 50 0 54 0; #P connect 54 0 69 0; #P connect 69 0 49 0; #P connect 49 0 47 0; #P connect 47 0 45 1; #P fasten 42 0 46 0 466 318 180 318; #P connect 46 0 56 1; #P fasten 69 0 48 0 167 271 223 271; #P connect 48 0 46 1; #P fasten 64 0 63 0 319 74 225 74; #P connect 63 0 62 0; #P fasten 25 0 62 1 436 180 248 180; #P fasten 60 0 65 0 319 205 259 205; #P connect 65 0 66 0; #P connect 66 0 67 0; #P connect 67 0 68 0; #P connect 64 0 61 0; #P connect 61 0 60 0; #P fasten 25 0 60 1 436 180 342 180; #P fasten 68 0 41 0 259 299 369 299 369 205 379 205; #P connect 41 0 40 0; #P fasten 39 0 20 0 433 249 379 249; #P connect 40 0 20 0; #P fasten 64 0 38 0 319 74 413 74; #P connect 38 0 37 0; #P fasten 18 0 39 0 693 352 684 352 684 226 433 226; #P fasten 4 0 26 0 483 106 436 106; #P connect 26 0 25 0; #P connect 25 0 37 1; #P fasten 7 0 27 0 593 123 584 123 584 81 453 81; #P connect 27 0 26 1; #P fasten 20 0 42 0 379 274 466 274; #P connect 42 0 9 0; #P connect 4 0 3 0; #P connect 3 0 2 0; #P connect 2 0 5 0; #P connect 5 0 6 0; #P connect 6 0 42 1; #P fasten 10 0 3 1 593 148 580 148 580 106 500 106; #P fasten 52 0 51 0 510 70 501 70 501 24 510 24; #P connect 51 0 52 0; #P fasten 10 0 1 0 593 148 580 148 580 110 513 110; #P connect 1 0 2 1; #P fasten 7 0 4 1 593 123 584 123 584 81 576 81; #P connect 51 1 7 0; #P fasten 19 0 7 0 631 98 593 98; #P connect 7 0 10 0; #P fasten 36 0 8 0 898 285 1029 285 1029 53 631 53; #P fasten 35 1 8 0 921 260 988 260 988 53 631 53; #P fasten 23 0 8 0 939 260 988 260 988 53 631 53; #P connect 8 0 19 0; #P connect 19 1 7 1; #P fasten 37 0 18 0 413 205 693 205; #P connect 13 1 12 0; #P fasten 71 0 12 0 755 147 702 147; #P connect 12 0 11 0; #P fasten 11 1 14 0 795 193 702 193; #P connect 70 0 71 0; #P connect 14 6 44 0; #P fasten 17 0 16 0 817 306 786 306; #P connect 44 0 16 0; #P connect 16 0 18 1; #P fasten 7 0 15 0 593 123 808 123; #P fasten 15 1 17 0 867 281 817 281; #P connect 44 1 43 0; #P connect 17 1 16 1; #P fasten 51 1 22 0 593 49 898 49; #P connect 22 0 21 0; #P fasten 43 1 21 0 881 260 889 260 889 172 898 172; #P connect 21 0 53 0; #P connect 53 0 24 0; #P connect 24 0 35 0; #P connect 35 0 36 0; #P connect 34 0 33 0; #P fasten 32 0 28 0 969 431 902 431 902 335 911 335; #P fasten 33 0 28 0 907 477 898 477 898 335 911 335; #P connect 22 1 21 1; #P connect 24 1 23 0; #P fasten 31 0 29 0 990 427 960 427 960 360 969 360; #P connect 29 0 30 0; #P connect 30 0 32 0; #P connect 30 1 31 0; #P connect 30 2 33 1; #P connect 28 1 29 1; #P fasten 24 2 36 1 980 239 1021 239; #P pop;