max v2; #N vpatcher 30 89 609 530; #P window setfont Times 10.; #P comment 106 80 226 1310730 First turn on audio (below) \, then start the tempo object; #P comment 33 349 58 1310730 click to turn audio on/off; #P comment 376 349 176 1310730 the lookup~ object uses the buffer~'s data because they share the same name ("xfer"); #P comment 138 378 309 1310730 this is the place in memory where we store the sound clip (512 samples) that will serve as the lookup table (transfer function) for the lookup~ object \, scanning the buffer~ with a sinusoid (cycle~) at the desired frequency; #P comment 461 262 61 1310730 show overall volume level; #P comment 322 311 202 1310730 use this shape to control the amplitude envelope (dynamics) over a longer time span; #P comment 150 284 202 1310730 use this shape to control the amplitude envelope (and timbre envelope) of each note; #P comment 10 262 67 1310730 (known as "waveshaping" synthesis); #P comment 10 210 81 1310730 use the sinusoidal waveform to scan through a more complex waveform; #P comment 134 153 43 1310730 convert MIDI pitch to frequency; #P comment 20 137 71 1310730 table of pitches (in MIDI terms); #P comment 406 119 119 1310730 the domain of this function is set to 15 seconds; #P comment 229 119 119 1310730 the domain of this function is set to 150 ms; #P window setfont "Fixedwidth Serif" 10.; #P user number~ 454 288 521 303 10 22 3 2 0. 1. 3 0. 150 0. 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 91 314 59 1441802 *~; #P newex 406 261 39 1441802 line~; #P user function 353 145 522 258 1 1 0 0; #X frgb 82 82 82; #X brgb 204 204 204; #X rgb2 85 85 85; #X rgb3 255 255 255; #X rgb4 0 0 0; #X rgb5 0 0 0; #X add 0. 1. 0; #X add 191.082809 0.034091 0; #X add 2006.369507 0.034091 0; #X add 3917.19751 0.068182 0; #X add 6019.108398 0.125 0; #X add 8121.019043 0.25 0; #X add 10031.847656 0.5 0; #X add 12038.216797 1. 0; #X add 12993.630859 0.5 0; #X add 13949.044922 0.125 0; #X add 15000. 0.034091 0; #X domain 15000.; #X range 0. 1.; #X done; #P newex 353 124 53 1441802 select 1; #P user ezdac~ 91 345 135 378 0; #P newex 91 287 59 1441802 *~; #P newex 91 124 98 1441802 t i b; #P newex 91 210 59 1441802 *~; #P newex 91 187 43 1441802 cycle~; #P flonum 6 188 79 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P number 6 168 35 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 91 166 33 1441802 mtof; #N vtable 16 40 104 250 271 970020 128; #T set 0 36 43 48 55 60 63 67 70 72 75 77 78 79 81 82 83; #P newobj 91 145 39 1441802 table; #P newex 91 103 98 1441802 tempo 100. 1 16; #P newex 143 347 233 1441802 buffer~ xfer "./Documentation/Tutorial Patches/MSP Tutorials/gtr512.aiff"; #P newex 91 233 80 1441802 lookup~ xfer; #P user function 179 145 348 258 1 1 0 0; #X frgb 82 82 82; #X brgb 204 204 204; #X rgb2 85 85 85; #X rgb3 255 255 255; #X rgb4 0 0 0; #X rgb5 0 0 0; #X add 0. 0. 0; #X add 4.77707 1. 0; #X add 20.063694 0.5 0; #X add 35.350319 0.25 0; #X add 49.68153 0.125 0; #X add 75.477707 0.079545 0; #X add 111.78344 0.034091 0; #X add 150. 0. 0; #X domain 150.; #X range 0. 1.; #X done; #P newex 232 261 39 1441802 line~; #P toggle 91 80 15 0; #P window setfont Times 10.; #P comment 91 22 329 1310730 This patch actually shows lookup tables (a.k.a. transfer functions) being used on three formal levels: 1) the microscopic level \, to determine the timbre of the waveform \, 2) the note level \, to determine the amplitude (and timbre) envelope \, and 3) at the "phrase" level \, to control the amplitude over a 15-second time span; #P fasten 7 0 9 0 11 163; #P fasten 8 0 10 0 11 184; #P connect 1 0 6 0; #P connect 6 0 13 0; #P connect 13 0 7 0; #P connect 7 0 8 0; #P connect 8 0 11 0; #P connect 11 0 12 0; #P connect 12 0 4 0; #P connect 4 0 14 0; #P connect 14 0 19 0; #P connect 19 0 15 0; #P fasten 19 0 15 1 96 338 130 338; #P fasten 2 0 12 1 237 282 174 282 174 205 145 205; #P fasten 2 0 14 1 237 282 145 282; #P fasten 18 0 19 1 411 309 145 309; #P connect 13 1 3 0; #P connect 3 1 2 0; #P fasten 1 0 16 0 96 99 358 99; #P connect 16 0 17 0; #P connect 17 1 18 0; #P fasten 18 0 20 0 411 282 459 282; #P pop;