max v2; #N vpatcher 10 59 691 706; #P window setfont Times 18.; #P comment 401 82 183 1310738 constant-power panning; #P window setfont Times 10.; #P comment 322 153 198 1310730 1. Open a soundfile \, 2. Turn audio on \, 3. Play it repeatedly if it's a short file \, 4. Adjust its amplitude \, 5. Change its panning; #P comment 219 54 120 1310730 when metro is stopped \, stop the soundfile playback also; #P comment 32 28 146 1310730 on/off to play the sound repeatedly by triggering it with a metronome; #P window setfont "Fixedwidth Serif" 10.; #P newex 166 57 53 1441802 select 0; #P toggle 17 32 15 0; #P window setfont Times 10.; #P comment 86 106 155 1310730 initial default rate of once per second; #P comment 126 86 110 1310730 triggering interval \, in ms; #P window setfont "Fixedwidth Serif" 10.; #P number 76 85 50 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P window setfont Times 10.; #P comment 367 358 96 1310730 transition time \, in ms; #P comment 303 358 61 1310730 L-R pan \, 0-1; #P window setfont "Fixedwidth Serif" 10.; #P number 369 372 57 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 316 372 35 10 0. 1. 3 22 0 0 0 221 221 221 222 222 222 0 0 0; #P window setfont Times 10.; #P comment 379 398 188 1310730 combine numbers together as a two-item list; #P window setfont "Fixedwidth Serif" 10.; #P newex 316 397 63 1441802 pack 0. 0; #P window setfont Times 10.; #P comment 356 485 301 1310730 use the square root of the amplitudes to keep a constant over-all intensity; #P window setfont "Fixedwidth Serif" 10.; #P newex 317 483 39 1441802 sqrt~; #P newex 233 483 39 1441802 sqrt~; #P window setfont Times 10.; #P comment 276 447 246 1310730 subtract the right channel's amplitude from a constant of 1 to get the left channel's amplitude; #P comment 379 423 152 1310730 initial default panning \, to the center; #P window setfont "Fixedwidth Serif" 10.; #P newex 233 450 43 1441802 !-~ 1.; #P window setfont Times 10.; #P comment 290 277 136 1310730 linear interpolation over 100 ms for smooth transitions; #P window setfont "Fixedwidth Serif" 10.; #P newex 316 420 63 1441802 line~ 0.5; #P window setfont Times 10.; #P comment 199 531 105 1310730 scale the output level of each channel for intensity panning effects; #P window setfont "Fixedwidth Serif" 10.; #P newex 172 531 27 1441802 *~; #P newex 141 531 27 1441802 *~; #P window setfont Times 10.; #P comment 23 546 56 1310730 audio on/off; #P comment 182 594 144 1310730 you must turn audio on explicitly; #P toggle 79 545 15 0; #P window setfont "Fixedwidth Serif" 10.; #P newex 141 592 41 1441802 dac~; #P window setfont Times 10.; #P comment 184 324 70 1310730 scale amplitude; #P window setfont "Fixedwidth Serif" 10.; #P newex 157 323 27 1441802 *~; #P window setfont Times 10.; #P comment 252 262 76 1310730 adjust amplitude; #P comment 227 303 104 1310730 initial default amplitude; #P window setfont "Fixedwidth Serif" 10.; #P flonum 217 261 35 10 0. 1. 3 22 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 217 279 73 1441802 pack 0. 100; #P newex 174 300 53 1441802 line~ 1.; #P window setfont Times 10.; #P comment 212 150 100 1310730 first you must open a soundfile from disk; #P window setfont "Fixedwidth Serif" 10.; #P message 237 176 33 1441802 open; #P window setfont Times 10.; #P comment 142 174 46 1310730 start/stop; #P window setfont "Fixedwidth Serif" 10.; #P newex 17 103 69 1441802 metro 1000; #P message 166 188 14 1441802 0; #P message 148 188 14 1441802 1; #N sfplay~ 1 120960 0 ; #P newobj 157 214 51 1441802 sfplay~; #P window setfont Times 10.; #P comment 208 212 100 1310730 plays the first channel of a soundfile from disk; #P connect 39 0 4 0; #P connect 36 0 4 1; #P fasten 13 0 19 0 162 398 146 398; #P connect 19 0 15 0; #P connect 16 0 15 0; #P fasten 4 0 2 0 22 124 153 124; #P connect 6 0 1 0; #P connect 3 0 1 0; #P connect 2 0 1 0; #P connect 1 0 13 0; #P fasten 27 0 19 1 238 518 163 518; #P fasten 39 0 40 0 22 53 171 53; #P connect 40 0 3 0; #P fasten 13 0 20 0 162 398 177 398; #P connect 20 0 15 1; #P connect 8 0 13 1; #P fasten 28 0 20 1 322 525 194 525; #P connect 10 0 9 0; #P connect 9 0 8 1; #P fasten 22 0 24 0 321 444 238 444; #P connect 24 0 27 0; #P connect 32 0 30 0; #P connect 30 0 22 0; #P connect 22 0 28 0; #P connect 33 0 30 1; #P pop;