max v2; #N vpatcher 78 48 976 705; #P window setfont Times 12.; #P window linecount 2; #P comment 11 53 413 1310732 Because the diatonic major scale is a non-linear function - a particular pattern of "whole tones" and "semitones" - we use a lookup table (array) to store the pattern.; #P window setfont "Fixedwidth Serif" 18.; #P window linecount 1; #N vtable 36 30 89 413 296 970020 128; #T set 0 36 38 40 41 43 45 47 48 50 52 53 55 57 59 60 62 64 65 67 69 71 72 74 76 77 79 81 83 84 86 88 89 91 93 95 96; #P newobj 259 376 65 1441810 table; #P window setfont Times 18.; #P window linecount 2; #P comment 576 468 297 1310738 provide note-on velocity \, then provide a note-off message after a given duration; #P comment 3 465 242 1310738 number box can be set to show numbers as MIDI note names; #P window setfont "Fixedwidth Serif" 18.; #P number 97 443 60 18 0 127 259 22 0 0 0 221 221 221 222 222 222 0 0 0; #P window setfont Times 18.; #P window linecount 1; #P comment 11 30 472 1310738 Use counter to play a 7-note ("diatonic") scale over five octaves; #P window linecount 2; #P comment 444 510 369 1310738 set port a in the MIDI Setup... dialog \, or you can double-click to select the port from a popup menu; #P window setfont "Fixedwidth Serif" 18.; #P window linecount 1; #P newex 335 515 109 1441810 noteout a; #P window setfont Times 18.; #P window linecount 2; #P comment 324 370 242 1310738 use the numbers to look up the notes of a C-major scale; #P window setfont "Fixedwidth Serif" 18.; #P number 335 443 44 18 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P window setfont Times 18.; #P comment 571 429 191 1310738 inter-onset interval is also used as the note duration; #P comment 384 430 184 1310738 combine with a note-on velocity (constant 100); #P window setfont "Fixedwidth Serif" 18.; #P window linecount 1; #P newex 335 469 241 1441810 makenote 100; #P window setfont Times 18.; #P window linecount 2; #P comment 391 87 281 1310738 convert rate (events per second) into the time interval needed by metro; #P window linecount 1; #P comment 752 56 100 1310738 initialize rate; #P window setfont "Fixedwidth Serif" 18.; #P flonum 351 202 71 18 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P message 733 54 19 1441810 8; #P newex 733 26 98 1441810 loadbang; #P window setfont Times 18.; #P comment 423 132 281 1310738 rate \, expressed as 'events per second'; #P window setfont Times 12.; #P comment 449 185 292 1310732 (compare with / \, which divides the input BY the argument); #P window setfont Times 18.; #P comment 449 165 269 1310738 divide the input INTO the argument; #P comment 422 203 147 1310738 time interval in ms; #P comment 41 276 101 1310738 count events; #P comment 33 242 109 1310738 timed triggers; #P comment 284 278 227 1310738 count 36 bangs (from 0 to 35); #P toggle 142 206 15 0; #P window setfont "Fixedwidth Serif" 18.; #P number 142 316 35 18 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 351 131 71 18 0 0 0 22 0 0 0 252 255 141 222 222 222 0 0 0; #P newex 351 162 98 1441810 !/ 1000.; #P newex 142 241 219 1441810 metro; #N counter 0 35; #X flags 0 0; #P newobj 142 275 142 1441810 counter 0 35; #P window setfont Times 18.; #P comment 86 183 141 1310738 toggle on/off (1/0); #P user panel 332 125 419 103; #X brgb 179 217 213; #X frgb 0 0 0; #X border 0; #X rounded 16; #X shadow 0; #X done; #P user panel 243 365 634 192; #X brgb 232 154 148; #X frgb 0 0 0; #X border 0; #X rounded 16; #X shadow 0; #X done; #P fasten 32 0 29 0 264 421 102 421; #P connect 8 0 4 0; #P connect 4 0 3 0; #P connect 3 0 7 0; #P fasten 7 0 32 0 147 344 264 344; #P fasten 32 0 24 0 264 421 340 421; #P connect 24 0 21 0; #P connect 21 0 26 0; #P fasten 17 0 6 0 738 85 356 85; #P connect 6 0 5 0; #P connect 5 0 18 0; #P connect 18 0 4 1; #P fasten 21 1 26 1 571 498 389 498; #P fasten 18 0 21 2 356 232 521 232 521 335 570 335; #P connect 16 0 17 0; #P pop;