̬̬̬̈̬̬̬̬̈̬̬̬̬̬̪쬪̬̬̬̪쬪 =?                      PPU UUPP PPPPPUUUP PUP @ PP  ]UUU UUUUUU PUUUUUUU UUUUPUUU PUUUU PP PUUUUUUUPUP PPUUUUUUUUUU PUUUUU                     q-- title: Music theory -- author: Sava -- desc: Little scale-based note player, even has a surprise at the end! -- license: MIT License -- version: 0.1 -- script: lua w=240 h=136 pat={ {len=400, func=function(scale, hScale) playNote(scale, 1, 0) end, vis=function() return {scale[1]} end}, -- play the scale {len=400, func=function(scale, hScale) playNote(scale, 2, 0) end, vis=function() return {scale[2]} end}, {len=400, func=function(scale, hScale) playNote(scale, 3, 0) end, vis=function() return {scale[3]} end}, {len=400, func=function(scale, hScale) playNote(scale, 4, 0) end, vis=function() return {scale[4]} end}, {len=400, func=function(scale, hScale) playNote(scale, 5, 0) end, vis=function() return {scale[5]} end}, {len=400, func=function(scale, hScale) playNote(scale, 6, 0) end, vis=function() return {scale[6]} end}, {len=400, func=function(scale, hScale) playNote(scale, 7, 0) end, vis=function() return {scale[7]} end}, {len=400, func=function(scale, hScale) playNote(scale, 8, 0) end, vis=function() return {scale[8]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 1, 0) end, vis=function() return {hScale[1]} end}, -- play the harmonic scale {len=400, func=function(scale, hScale) playNote(hScale, 2, 0) end, vis=function() return {hScale[2]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 3, 0) end, vis=function() return {hScale[3]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 4, 0) end, vis=function() return {hScale[4]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 5, 0) end, vis=function() return {hScale[5]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 6, 0) end, vis=function() return {hScale[6]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 7, 0) end, vis=function() return {hScale[7]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 8, 0) end, vis=function() return {hScale[8]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 1, 0) end, vis=function() return {hScale[1]} end}, -- play the tonic triad, split up {len=400, func=function(scale, hScale) playNote(hScale, 3, 0) end, vis=function() return {hScale[3]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 5, 0) end, vis=function() return {hScale[5]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 3, 0) end, vis=function() return {hScale[3]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 1, 0) end, vis=function() return {hScale[1]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 5, -12) end, vis=function() return {hScale[5]-12} end}, {len=800, func=function(scale, hScale) playNote(hScale, 1, 0) end, vis=function() return {hScale[1]} end}, {len=2000, func=function(scale, hScale) -- actually play the tonic triad playNote(scale, 1, 0) playNote(scale, 3, 0) playNote(scale, 5, 0) playNote(scale, 8, 0) end, vis=function() return {hScale[1], hScale[3], hScale[5], hScale[8]} end}, {len=1000, func=function(scale, hScale) end, vis=function() return {} end}, -- pause {len=400, func=function(scale, hScale) -- play the dominant 6th chord, split up playNote(hScale, 5, 0) end, vis=function() return {hScale[5]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 5, 0) playNote(hScale, 7, 0) end, vis=function() return {hScale[5], hScale[7]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 5, 0) playNote(hScale, 7, 0) playNote(hScale, 2, 12) end, vis=function() return {hScale[5], hScale[7], hScale[2]+12} end}, {len=1600, func=function(scale, hScale) playNote(hScale, 5, 0) playNote(hScale, 7, 0) playNote(hScale, 2, 12) playNote(hScale, 4, 12) end, vis=function() return {hScale[5], hScale[7], hScale[2]+12, hScale[4]+12} end}, {len=400, func=function(scale, hScale) -- dominant 7th resolution playNote(hScale, 1, 12) end, vis=function() return {hScale[1]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 1, 12) end, vis=function() return {hScale[1]} end}, {len=400, func=function(scale, hScale) playNote(hScale, 1, 12) end, vis=function() return {hScale[1]} end}, {len=800, func=function(scale, hScale) playNote(hScale, 3, 12) end, vis=function() return {hScale[3]} end}, {len=1000, func=function(scale, hScale) end, vis=function() return {} end}, -- pause {len=400, func=function(scale, hScale) -- play the resolution of the diminished 7th playNote(hScale, 1, 0) end, vis=function() return {hScale[1]} end}, {len=1200, func=function(scale, hScale) playNote(hScale, 5, 0) end, vis=function() return {hScale[5]} end}, {len=400, func=function(scale, hScale) -- play the diminished 7th playNote(hScale, 7, -12) end, vis=function() return {hScale[7]-12} end}, {len=400, func=function(scale, hScale) playNote(hScale, 6, 0) end, vis=function() return {hScale[6]} end}, {len=600, func=function(scale, hScale) playNote(hScale, 1, 0) end, vis=function() return {hScale[1]} end}, {len=1200, func=function(scale, hScale) playNote(hScale, 5, 0) end, vis=function() return {hScale[5]} end}, {len=1000, func=function(scale, hScale) end, vis=function() return {} end}, {len=400, func=function(scale, hScale) -- play the resolution of the augmented 2nd playNote(hScale, 1, 0) end, vis=function() return {hScale[1]} end}, {len=1200, func=function(scale, hScale) playNote(hScale, 5, -12) end, vis=function() return {hScale[5]-12} end}, {len=400, func=function(scale, hScale) -- play the augmented 2nd playNote(hScale, 6, -12) end, vis=function() return {hScale[6]-12} end}, {len=400, func=function(scale, hScale) playNote(hScale, 7, -12) end, vis=function() return {hScale[7]-12} end}, {len=600, func=function(scale, hScale) playNote(hScale, 5, -12) end, vis=function() return {hScale[5]-12} end}, {len=1200, func=function(scale, hScale) playNote(hScale, 1, 0) end, vis=function() return {hScale[1]} end}, {len=4000, func=function(scale, hScale) end, vis=function() return {} end}, -- pause {len=0, func=function(scale, hScale) pat = pat1 curPat = 1 noteReset = false end, vis=function() return {} end} } function parseM(arr) local ret = {{len=500, func=function(scale, hScale) noteReset = false end, vis=function() return {} end}} for i=1, #arr-3, 3 do ret[i//3+2] = {len=(arr[i+4]-arr[i+1])/2.5, func=function(scale, hScale) sfx(0, arr[i], arr[i+2]/1000*60+10/60, cNote) pNotes[cNote+1]=arr[i] cNote=(cNote+1)%4 end, vis=function() return {arr[i]} end} end ret[#ret+1] = {len=0, func=function(scale, hScale) exit() end, vis=function() return {} end} return ret end pat1 = parseM({37,4000,88,44,4161,119,49,4375,140,44,4421,104,52,4552,114,56,4666,104,37,4713,98,49,4833,177,52,5005,119,44,5031,260,56,5197,93,61,5364,260,37,5411,104,52,5562,98,44,5708,119,56,5713,140,61,5859,83,64,6046,286,37,6083,114,56,6218,197,61,6375,140,44,6380,255,64,6520,239,68,6713,125,37,6822,119,61,6869,213,64,7072,140,44,7109,218,68,7229,250,73,7390,125,37,7437,104,64,7604,119,68,7729,151,44,7765,234,73,7901,276,76,8083,135,37,8098,125,68,8270,140,73,8406,98,44,8427,239,76,8526,130,76,8765,203,73,8770,229,68,8770,229,80,8770,270,49,8786,239,37,8802,276,80,9130,83,68,9135,104,76,9145,145,73,9156,98,44,9213,213,36,9656,187,44,9843,375,48,10052,229,51,10234,296,56,10416,109,36,10437,156,48,10614,182,44,10760,151,51,10776,244,56,10937,312,60,11104,166,36,11161,114,51,11312,119,56,11479,145,44,11479,208,60,11625,286,63,11812,114,36,11864,244,56,11989,250,44,12177,130,60,12182,255,63,12375,229,36,12557,109,68,12557,130,60,12750,166,63,12895,119,44,12911,250,68,13093,203,36,13250,125,72,13270,114,63,13395,218,68,13572,125,44,13572,250,72,13713,239,75,13906,135,36,13921,151,68,14041,255,72,14213,104,44,14265,229,75,14375,78,75,14541,119,80,14541,244,72,14546,255,68,14546,244,48,14572,286,36,14593,307,75,14932,83,80,14937,145,68,14958,151,72,14958,156,44,14973,197,35,15348,145,49,15494,270,44,15687,119,53,15718,218,56,15869,93,35,16052,281,61,16072,109,53,16244,203,44,16375,145,56,16401,223,61,16552,93,65,16755,302,35,16760,130,56,16916,244,44,17083,166,61,17088,296,65,17239,307,68,17453,88,35,17494,213,61,17614,260,44,17791,145,65,17817,281,68,17968,286,73,18161,93,35,18197,213,65,18333,239,68,18479,182,44,18489,296,73,18666,260,77,18854,93,35,18875,93,68,19000,255,73,19171,130,44,19213,296,77,19307,276,80,19500,145,35,19520,177,73,19640,307,77,19854,114,44,19859,78,80,19979,260,47,20203,114,80,20208,270,85,20208,286,73,20208,296,77,20213,317,35,20229,328,77,20625,88,73,20630,135,80,20640,140,85,20640,156,44,20666,223,33,21093,239,49,21281,218,45,21458,229,54,21479,229,57,21645,182,61,21791,78,33,21802,177,61,21968,265,45,22166,229,66,22203,307,69,22390,130,73,22500,83,33,22520,125,73,22687,276,78,22895,130,45,22937,171,81,23114,98,33,23270,255,85,23270,250,78,23281,265,73,23302,281,85,23666,130,78,23677,145,73,23677,156,45,23687,187,33,24093,250,49,24250,239,52,24437,177,45,24479,265,55,24625,218,61,24781,78,33,24812,177,61,24958,244,64,25145,234,45,25161,239,67,25328,229,33,25494,67,73,25510,156,73,25692,260,76,25875,114,45,25895,187,79,26031,83,79,26260,130,73,26260,161,85,26265,276,33,26265,276,45,26281,291,85,26723,72,73,26729,78,79,26729,260,45,26744,312,33,26755,312,72,27239,62,84,27239,145,80,27244,213,44,27260,229,32,27270,239,56,27927,171,60,27953,197,68,27958,223,80,28151,161,68,28385,380,60,28390,250,80,28552,244,61,28744,234,70,28750,552,80,28942,250,72,29166,375,63,29171,229,80,29354,270,64,29541,244,73,29572,468,80,29750,229,66,29958,265,75,29979,458,80,30130,229,72,30354,427,63,30364,270,80,30541,302,66,30750,442,75,30760,239,80,30958,197,73,31130,3510,64,31166,296,80,31338,239,78,31546,312,69,31557,192,80,31750,401,68,31921,250,76,31921,395,80,32125,208,75,32312,276,66,32333,276,80,32500,218,73,32697,218,64,32718,270,80,32875,203,72,33104,119,63,33109,151,80,33250,250,61,33468,88,69,33484,161,79,33682,130,68,33864,109,56,33869,203,60,33895,223,80,34067,182,68,34270,203,60,34307,213,80,34453,140,68,34651,296,60,34666,244,80,34833,171,70,35057,244,61,35078,484,80,35255,281,72,35479,317,63,35489,234,80,35651,250,73,35854,218,64,35864,421,80,36020,239,66,36229,291,75,36234,234,80,36401,213,63,36588,333,72,36588,234,80,36786,302,66,36958,229,75,36984,458,80,37182,250,73,37333,3786,64,37359,348,80,37531,260,78,37739,328,69,37750,187,80,37937,411,76,38083,296,68,38083,333,80,38296,203,66,38468,239,75,38473,260,80,38671,218,64,38854,171,73,38854,281,80,39020,234,63,39229,145,72,39229,151,80,39380,218,61,39583,88,69,39598,161,79,39776,151,60,39958,88,56,39963,98,68,39979,197,80,40171,135,61,40338,83,69,40338,83,56,40354,130,79,40526,109,68,40682,88,60,40703,98,56,40723,239,80,40875,145,61,41041,93,56,41052,93,69,41062,114,79,41208,151,68,41380,98,60,41380,93,56,41411,229,80,41562,203,69,41729,109,56,41750,125,61,41755,218,79,41901,182,68,42098,98,60,42114,83,56,42145,250,80,42286,223,61,42520,93,69,42531,125,56,42541,208,79,42666,145,68,42901,78,80,42901,78,60,42906,119,56,42911,145,56,43776,3520,44,43791,3557,32,43812,3562,37,48052,88,44,48223,109,49,48427,151,44,48453,130,52,48630,109,37,48750,109,56,48770,114,49,48958,255,52,49093,125,44,49093,234,56,49291,239,37,49453,109,61,49463,114,52,49656,166,44,49723,130,56,49817,244,61,49989,114,37,50130,83,64,50166,286,56,50307,229,44,50421,135,61,50453,312,64,50635,270,68,50817,114,37,50833,218,61,50947,276,44,51156,156,64,51161,229,68,51333,203,73,51473,130,37,51531,98,64,51656,182,68,51796,125,44,51854,244,73,52000,67,76,52140,250,37,52187,114,76,52312,250,80,52479,104,44,52541,244,85,52687,104,85,52848,109,76,52848,145,88,52854,177,49,52869,213,37,52890,218,76,53281,72,88,53286,83,44,53312,114,34,53864,218,52,54083,239,55,54276,145,49,54281,265,61,54473,296,64,54640,140,46,54656,218,55,54833,239,49,54979,182,61,55020,270,64,55177,281,46,55354,98,67,55369,166,61,55562,208,49,55697,125,64,55708,291,67,55916,119,46,56062,265,73,56098,291,64,56302,197,49,56401,119,67,56463,265,73,56635,140,46,56812,317,76,56828,270,67,56994,244,49,57166,140,73,57166,296,76,57322,229,79,57489,72,46,57541,156,73,57656,265,76,57812,125,49,57875,302,79,58005,244,85,58177,239,46,58208,244,76,58359,239,79,58510,119,49,58526,260,85,58697,62,76,58906,166,88,58911,390,46,58916,213,34,58937,250,49,59333,62,76,59343,98,88,59343,114,31,59864,223,51,60114,432,58,60338,260,61,60515,333,63,60734,125,43,60739,130,58,60916,229,51,61083,177,61,61104,234,63,61291,223,70,61458,93,43,61484,307,61,61625,255,63,61812,187,51,61812,223,70,62026,291,73,62203,104,43,62239,317,63,62385,223,51,62583,151,70,62588,276,73,62791,291,75,62979,114,43,62989,223,70,63145,270,51,63322,192,73,63338,250,75,63494,250,82,63687,119,43,63739,333,73,63833,255,75,64041,161,51,64052,270,82,64218,255,85,64406,213,43,64479,343,82,64604,348,75,64848,151,51,64875,223,73,65000,203,82,65234,140,43,65286,255,75,65479,302,73,65713,151,51,65718,203,70,65875,244,71,66166,421,44,66171,447,51,66489,140,47,66770,166,51,67026,171,75,67395,375,44,67437,156,51,67713,130,47,67854,208,51,68052,161,44,68291,109,51,68572,156,47,68718,286,51,68937,2098,71,69270,151,44,69348,645,51,69619,130,68,69828,187,47,69833,177,67,70036,166,51,70125,192,68,70218,1067,70,70406,317,46,70458,161,68,70583,177,51,70760,750,49,71031,145,51,71291,1145,67,71520,328,46,71588,130,51,71812,156,49,71979,703,51,72260,171,46,72416,166,51,72625,166,67,72765,161,49,72854,135,51,73093,510,75,73208,197,46,73270,145,51,73447,614,49,73692,125,67,73859,890,51,73968,140,70,74062,151,47,74145,130,51,74375,171,47,74526,156,51,74750,1062,68,74932,151,47,75010,156,51,75192,192,47,75348,177,51,75578,942,47,75770,151,51,75973,156,68,76119,135,47,76171,135,51,76395,427,75,76557,140,47,76604,119,51,76822,213,47,76953,671,51,77161,135,68,77161,270,71,77375,177,43,77375,187,51,77625,145,43,77854,156,51,78078,1031,70,78255,145,43,78312,151,51,78515,166,43,78713,213,51,78911,1020,43,79104,187,51,79359,151,70,79473,187,43,79562,171,51,79822,640,75,80041,166,43,80041,171,51,80260,244,43,80442,734,51,80713,145,70,80729,145,44,80979,244,71,80984,343,51,81312,151,87,81552,156,75,81562,140,47,81614,468,51,81833,505,44,82031,177,51,82250,145,87,82395,130,75,82411,119,47,82437,484,51,82671,505,44,82822,229,51,83052,135,87,83197,104,75,83197,109,47,83239,135,51,83453,151,83,83630,62,44,83635,83,71,83640,223,51,83822,192,68,84015,114,80,84015,145,47,84041,171,51,84239,218,68,84437,244,80,84453,270,46,84473,260,51,84651,270,67,84895,182,79,84901,182,49,84911,458,51,85114,489,46,85302,140,51,85510,192,79,85692,125,67,85703,130,49,85729,411,51,85947,473,46,86109,130,51,86296,187,67,86505,78,79,86510,93,49,86520,166,51,86729,156,46,86958,83,87,86968,93,75,86973,197,51,87156,197,49,87375,72,79,87411,98,67,87416,250,51,87604,229,82,87807,145,70,87812,161,47,87822,192,51,88041,234,80,88250,140,68,88250,182,47,88255,484,51,88447,520,47,88661,119,51,88843,208,68,89036,104,80,89036,234,47,89083,494,51,89276,505,47,89479,104,51,89651,234,68,89807,161,80,89822,125,47,89875,223,51,90062,229,87,90244,67,75,90250,93,47,90270,171,51,90437,234,47,90645,98,80,90656,229,68,90656,250,51,90812,213,83,91062,93,71,91067,182,43,91078,229,51,91281,213,82,91489,125,70,91489,218,43,91531,453,51,91708,484,43,91942,166,51,92114,208,70,92328,208,82,92328,223,43,92354,567,51,92536,572,43,92750,208,51,92927,197,70,93119,151,82,93125,213,43,93156,218,51,93354,208,75,93526,98,87,93526,151,43,93562,218,51,93708,197,43,93927,125,70,93932,234,82,93937,244,51,94083,213,84,94359,312,72,94359,223,42,94375,250,51,94588,208,44,94744,255,51,94958,1223,42,95171,208,51,95385,1244,44,95588,229,51,95791,208,85,95989,177,73,95994,213,40,96046,218,49,96244,182,44,96421,843,49,96635,973,40,96833,203,49,97046,197,44,97239,265,49,97479,208,70,97651,208,82,97661,375,40,97718,239,83,97822,354,49,97937,281,82,98005,307,42,98166,989,80,98218,260,82,98411,604,49,98437,442,71,98687,354,83,98687,229,39,98713,239,47,98937,239,42,99135,223,47,99312,208,39,99562,213,47,99770,1671,42,99958,218,47,100161,1723,39,100364,255,47,100515,218,42,100760,276,47,100973,223,80,101166,286,68,101177,187,38,101192,182,47,101406,166,40,101588,239,47,101812,140,38,102036,1250,47,102276,1442,40,102479,187,47,102687,166,81,102885,312,69,102901,250,37,102911,229,45,103125,187,40,103348,239,45,103541,1171,37,103760,145,45,103979,1276,40,104192,203,45,104338,182,79,104583,72,67,104593,145,37,104604,375,69,104687,208,80,104843,260,46,104854,614,39,105041,291,77,105166,453,46,105312,239,79,105312,385,78,105588,171,68,105604,239,80,105614,531,35,105625,270,44,105838,218,39,106078,239,44,106281,223,35,106510,234,44,106734,244,39,106916,1937,44,107130,213,35,107369,2015,44,107562,197,39,107770,244,44,107953,109,81,108494,1083,69,108494,1093,73,108494,1098,76,108494,1114,49,108505,1125,45,108520,1229,37,108531,1234,40,108536,2104,76,110536,255,78,110703,244,80,110901,203,81,111104,218,83,111322,192,85,111520,291,83,111703,255,69,111875,140,61,111885,385,64,111895,197,81,111911,427,76,112114,468,78,112328,203,80,112515,203,81,112718,208,83,112947,197,85,113166,255,83,113375,166,81,113541,88,69,113541,364,61,113583,182,64,113598,401,76,113734,395,78,113916,203,80,114104,203,81,114312,223,83,114526,213,85,114718,286,83,114932,192,69,115125,98,81,115135,260,61,115166,322,64,115177,317,76,115338,182,78,115526,270,80,115713,119,81,115911,151,69,115916,338,61,115953,307,64,115963,328,83,116098,260,85,116312,203,86,116515,135,69,116687,130,88,116729,286,64,116729,406,61,116734,369,87,116921,192,88,117104,208,87,117286,223,88,117505,291,69,117520,317,61,117557,302,64,117572,359,85,117744,260,83,117937,229,81,118151,203,80,118364,151,63,118406,125,71,118583,125,68,118807,114,71,119031,104,63,119229,109,71,119453,145,68,119604,1411,71,119807,98,82,120000,125,63,120000,187,83,120130,88,73,120192,156,82,120317,109,67,120442,98,83,120468,125,82,120583,250,73,120598,250,83,120786,229,63,120895,125,82,120947,250,73,121156,223,80,121177,234,82,121354,213,80,121583,62,71,121583,72,64,121588,93,68,121593,197,45,122640,572,37,122645,572,57,122651,583,64,122651,583,69,122656,625,49,122656,656,61,122661,687,40,122666,1515,64,124166,119,66,124328,255,68,124489,192,69,124687,208,71,124906,177,73,125072,276,71,125270,187,69,125458,104,64,125645,208,66,125880,182,68,126041,187,57,126234,98,49,126234,145,69,126239,182,52,126260,208,71,126442,208,73,126651,291,71,126875,161,69,127062,104,64,127250,197,66,127479,208,68,127666,197,57,127828,109,49,127854,88,69,127854,119,52,127859,244,71,128104,197,73,128291,291,71,128479,229,69,128697,109,64,128906,171,57,129078,104,52,129083,109,49,129093,119,66,129109,250,68,129302,177,69,129473,244,71,129729,161,57,129838,104,49,129843,135,52,129848,140,73,129895,291,71,130067,255,69,130255,130,64,130447,218,66,130645,93,57,130656,109,49,130666,109,52,130666,260,68,130838,192,69,131031,223,71,131250,161,73,131411,88,57,131411,93,49,131416,109,52,131421,343,71,131588,244,69,131781,156,57,131807,213,49,131807,239,52,131817,244,64,131968,239,66,132192,270,68,132395,182,69,132578,171,71,132781,260,73,132979,166,74,133187,239,76,133359,291,78,133541,312,80,133734,171,81,133921,223,83,134104,265,85,134291,192,86,134468,239,87,134666,166,88,134963,182,76,134979,395,49,135000,156,57,135171,661,52,135416,145,57,135625,151,49,135833,343,57,136015,223,52,136213,177,57,136390,1729,80,136567,406,68,136583,192,50,136614,234,59,136833,187,53,137010,942,59,137208,239,50,137395,218,59,137593,213,53,137807,1557,59,137989,192,71,138166,239,83,138166,484,51,138223,453,59,138375,260,56,138572,666,59,138770,208,51,139015,88,59,139244,83,56,139458,208,59,139541,703,67,139854,234,55,139854,265,61,139864,151,39,139890,192,51,140083,239,50,140333,1109,51,140500,1255,50,140697,218,51,140895,1286,50,141062,244,51,141312,208,44,141578,161,68,141583,182,56,141583,234,59,141583,281,71,142098,104,56,142104,119,63,142104,135,71,142489,98,56,142510,125,63,142510,119,63,142911,109,56,142916,109,71,142916,125,71,143307,104,63,143312,109,56,143333,114,56,143718,114,71,143729,104,63,143739,114,63,144093,114,58,144098,130,70,144098,130,68,144494,109,59,144510,98,63,144515,125,61,144890,93,51,144895,98,67,144895,104,63,144906,98,75,145255,98,63,145312,119,61,145317,130,67,145317,140,67,145645,98,63,145645,130,75,145651,140,61,145651,161,67,146031,104,75,146041,114,63,146041,114,61,146052,114,67,146432,114,75,146437,114,61,146437,119,63,146437,119,75,146812,98,67,146822,125,63,146833,98,61,146854,125,75,147203,104,59,147213,104,68,147213,104,63,147229,182,63,147567,88,70,147567,93,58,147572,98,75,147588,130,75,147958,83,56,147963,78,71,147963,93,44,147973,104,71,148322,104,63,148333,119,56,148338,135,71,148708,125,56,148729,109,63,148729,114,71,149114,119,63,149125,114,56,149125,125,63,149489,114,71,149489,119,56,149489,130,71,149869,109,63,149875,109,56,149885,114,70,150223,119,63,150234,145,58,150239,135,68,150609,98,63,150625,119,59,150625,130,61,151000,93,63,151005,104,51,151005,104,67,151010,151,75,151375,104,67,151395,119,63,151406,135,61,151406,151,63,151750,98,67,151750,119,61,151750,135,75,151770,135,67,152125,119,75,152130,109,63,152135,125,61,152145,130,75,152500,109,67,152515,119,63,152515,156,61,152520,229,75,152854,151,67,152869,130,63,152875,213,61,152895,229,68,153208,109,75,153223,187,63,153234,229,59,153250,234,75,153583,83,63,153588,93,70,153588,145,58,153604,208,75,153963,72,44,153968,88,71,153979,192,75,154364,114,71,154375,88,56,154390,119,59,154416,218,75,154760,145,71,154760,182,59,154791,312,56,154812,468,71,155151,98,63,155151,109,68,155166,229,59,155166,255,49,155546,88,73,155953,104,76,155953,104,56,155958,114,61,155968,109,76,156354,130,73,156354,119,61,156375,359,56,156385,416,73,156713,104,68,156713,125,61,156718,239,64,156729,250,51,157088,140,75,157458,104,71,157479,104,59,157489,125,56,157500,166,75,157859,98,71,157880,130,56,157911,229,59,157947,437,63,158260,125,68,158265,125,71,158276,156,59,158281,187,51,158656,177,75,159000,114,70,159005,119,55,159010,114,58,159020,125,55,159375,161,75,159416,156,70,159416,161,58,159500,395,58,159781,104,70,159812,125,67,159822,130,63,159828,156,68,160281,88,71,160286,104,32,160291,109,44,160770,114,51,160781,125,83,160791,109,71,160791,125,83,161135,125,71,161135,114,75,161151,130,51,161156,119,44,161166,130,83,161505,114,71,161515,135,75,161536,119,51,161546,119,44,161562,197,83,161854,109,71,161875,130,75,161880,145,51,161885,156,44,161895,229,83,162218,109,51,162229,114,75,162239,135,44,162250,182,71,162250,218,70,162567,135,82,162572,156,73,162588,182,51,162593,151,46,162619,213,80,162927,109,68,162932,156,71,162932,218,51,162953,223,47,162973,234,49,163317,62,70,163328,67,67,163328,78,39,163333,83,79,163333,218,88,163750,72,79,163760,93,61,163760,93,76,163765,135,51,163776,177,76,164119,98,88,164125,119,79,164125,166,61,164130,192,51,164145,234,88,164473,104,79,164473,187,76,164473,208,61,164479,239,51,164500,255,61,164838,88,88,164843,177,76,164848,192,79,164854,223,51,164875,229,61,165203,72,76,165213,151,88,165213,187,79,165218,192,51,165250,291,75,165583,83,87,165583,130,59,165593,218,51,165598,229,79,165604,270,58,165932,78,85,165937,88,73,165942,218,51,165958,203,79,165963,234,71,166317,62,83,166317,88,44,166328,182,80,166328,197,32,166333,229,71,166723,104,83,166729,119,44,166729,125,51,166729,171,75,166734,208,51,167067,125,75,167067,130,83,167078,182,71,167083,213,44,167083,218,71,167442,130,83,167447,119,75,167458,145,51,167463,208,44,167479,218,83,167807,130,51,167807,166,71,167812,187,75,167812,218,44,167817,234,83,168197,83,71,168203,156,75,168203,151,51,168213,156,44,168213,192,70,168546,130,82,168562,187,73,168562,161,51,168583,187,46,168583,234,68,168906,140,80,168911,166,51,168932,234,47,168937,255,71,168942,250,67,169291,62,39,169291,78,79,169296,88,49,169296,98,70,169302,156,61,169703,88,51,169703,88,79,169703,114,88,169708,177,76,169713,255,79,170057,104,61,170062,187,76,170062,203,88,170062,229,51,170062,229,88,170432,98,51,170432,187,79,170437,192,76,170437,192,61,170437,234,61,170807,171,79,170812,161,76,170812,182,88,170812,187,51,170828,250,88,171192,161,79,171192,145,76,171192,197,61,171208,192,51,171213,281,59,171541,109,51,171541,125,87,171562,156,75,171562,166,79,171583,187,58,171906,93,85,171921,78,73,171921,203,79,171937,234,51,171937,239,44,172302,62,56,172307,62,71,172312,72,83,172312,88,80,172328,145,80,172734,78,63,172739,93,83,172750,114,59,172770,93,80,173145,140,83,173145,229,59,173151,437,63,173166,427,59,173520,166,83,173526,135,87,173536,270,56,173562,458,49,173942,78,85,174307,104,80,174317,114,61,174333,125,64,174343,192,80,174682,182,85,174687,260,61,174703,307,64,174718,427,88,175078,114,85,175083,140,61,175083,171,56,175088,291,51,175484,83,80,175812,104,59,175812,119,63,175812,125,83,175812,166,80,176208,234,83,176208,234,59,176223,312,63,176229,307,83,176604,119,59,176604,234,56,176614,250,87,176625,437,49,177015,88,82,177380,119,79,177385,125,63,177385,135,58,177416,223,82,177744,177,79,177776,244,58,177791,302,63,177791,427,82,178171,104,58,178171,151,87,178208,322,55,178218,317,47,178604,83,75,179020,135,83,179031,119,68,179052,223,63,179072,250,83,179421,104,75,179427,156,68,179463,213,63,179500,307,63,179807,109,87,179828,135,80,179854,119,59,179880,109,49,180229,93,81,180635,109,69,180640,114,64,180640,125,73,180645,135,81,181036,140,73,181046,140,69,181062,265,85,181411,88,76,181416,104,61,181437,166,64,181437,312,51,181812,88,80,182192,125,71,182203,119,68,182223,130,63,182234,192,80,182598,119,71,182609,135,63,182609,140,68,182625,302,83,182994,114,75,183005,338,63,183010,395,51,183390,98,79,183817,145,70,183848,140,67,183864,145,61,183869,156,79,184312,151,70,184343,250,67,184375,333,61,184390,541,58,184812,145,61,184822,166,73,184822,427,82,184822,677,44,185375,151,80,185385,510,71,185395,135,56,185619,140,51,185864,130,56,186093,1140,44,186302,1239,56,186541,130,51,186760,130,56,186968,156,44,187135,140,56,187364,218,51,187671,151,56,187854,145,71,187937,119,44,188057,161,56,188276,770,51,188588,156,56,188744,265,68,188750,281,67,189005,208,44,189005,489,58,189255,640,51,189505,151,58,189692,213,75,189890,130,61,189906,192,44,189932,286,67,189942,359,58,190145,182,51,190395,151,58,190578,197,75,190776,250,61,190812,390,44,190812,151,67,190822,479,58,191098,447,51,191312,156,58,191463,229,75,191661,145,61,191692,328,67,191713,161,44,191729,390,58,191932,432,51,192192,145,58,192333,125,59,192562,177,44,192588,281,68,192718,182,56,192864,161,75,192963,171,51,193203,125,56,193359,156,44,193604,125,56,193854,151,51,194052,1718,56,194250,1567,44,194479,140,56,194703,145,51,194973,151,56,195182,218,83,195546,130,44,195578,140,56,195802,135,51,196062,833,56,196291,192,80,196395,161,44,196578,197,79,196625,578,58,196875,161,51,197098,645,58,197312,213,87,197541,125,73,197572,119,44,197578,213,79,197593,333,58,197807,161,51,198062,145,58,198234,161,87,198432,109,73,198442,125,79,198479,187,44,198479,380,58,198708,135,51,198911,145,58,199083,156,87,199255,135,73,199270,354,44,199281,135,79,199281,390,58,199500,145,51,199708,578,58,199885,114,44,200098,104,71,200125,505,80,200328,218,56,200395,140,87,200526,140,51,200723,875,56,200921,125,44,201156,125,56,201395,1010,51,201552,145,56,201703,151,73,201802,156,44,201875,291,79,201989,177,87,202114,322,58,202130,135,51,202473,140,58,202614,156,44,202791,843,58,203041,145,51,203208,125,58,203333,135,71,203546,109,44,203562,125,80,203755,208,56,203791,125,87,203958,119,51,204062,781,56,204234,156,44,204416,796,56,204645,145,51,204864,135,56,205052,114,73,205255,177,44,205286,265,79,205447,166,58,205500,281,87,205593,151,51,205755,390,58,205937,156,44,206145,135,58,206395,145,51,206609,140,58,206739,140,59,206968,145,44,207000,182,68,207171,166,56,207218,442,63,207375,130,51,207437,145,68,207546,151,56,207625,135,59,207750,119,44,207812,208,68,207958,151,56,208020,140,63,208145,109,51,208250,161,68,208307,223,56,208390,145,59,208536,114,44,208572,239,68,208697,135,56,208781,223,63,208916,119,51,209026,140,68,209072,151,56,209130,250,59,209296,109,44,209333,208,68,209458,385,56,209463,265,63,209677,171,51,209682,177,56,209796,197,68,209843,296,60,210005,265,44,210010,223,54,210192,250,66,210197,463,63,210364,265,51,210380,270,66,210562,187,54,210562,239,60,210729,218,44,210750,223,54,210880,208,66,210906,229,63,211088,208,51,211104,229,54,211265,203,66,211276,229,60,211468,182,44,211500,234,54,211640,208,66,211651,244,63,211833,229,51,211859,276,66,212020,229,54,212046,234,60,212213,234,44,212276,322,66,212385,260,54,212432,239,63,212630,104,51,212651,244,66,212750,244,54,212807,109,52,213338,78,56,213343,78,61,213343,88,64,213354,83,37,213354,145,44,213729,250,49,213885,260,52,214057,88,37,214166,213,56,214187,229,49,214343,218,44,214484,109,52,214510,255,56,214677,78,61,214848,270,37,214869,197,52,215015,234,56,215171,119,44,215171,307,61,215375,104,64,215520,119,37,215541,286,56,215697,265,44,215854,145,61,215864,302,64,216020,265,68,216197,98,37,216234,218,61,216333,286,64,216510,145,44,216557,296,68,216697,260,73,216875,93,37,216916,239,64,217041,234,68,217177,135,44,217234,229,73,217369,244,76,217546,93,37,217562,234,68,217687,239,73,217843,104,44,217895,234,76,218031,229,73,218171,234,49,218171,255,80,218177,432,37,218177,286,68,218197,312,80,218541,62,76,218552,72,68,218557,88,73,218557,171,44,218578,213,36,218958,182,44,219125,416,48,219317,239,51,219489,302,56,219687,114,36,219692,213,48,219854,229,44,219984,182,51,220010,317,56,220192,104,36,220375,317,60,220442,98,51,220546,203,44,220687,244,56,220718,296,60,220869,281,36,221052,197,63,221072,218,56,221187,291,60,221375,192,44,221406,302,63,221583,239,68,221734,182,36,221791,218,60,221921,213,63,222062,177,44,222125,286,68,222244,286,72,222437,104,36,222447,182,63,222588,223,68,222723,203,44,222776,312,72,222906,250,75,223072,151,36,223078,182,68,223208,93,72,223411,322,44,223437,218,75,223562,83,80,223718,239,68,223723,229,48,223729,260,75,223729,270,72,223729,286,36,223755,291,80,224078,62,68,224093,114,44,224114,130,75,224119,161,72,224130,218,35,224541,187,49,224703,239,44,224859,229,53,224901,250,56,225057,312,35,225260,119,61,225286,192,53,225463,192,44,225578,260,56,225614,244,61,225791,312,65,225979,145,35,225984,223,56,226182,192,58,226250,182,44,226312,265,61,226354,312,65,226526,281,68,226729,171,35,226729,208,61,226854,302,44,227041,250,65,227041,307,68,227229,281,73,227406,192,35,227447,156,65,227567,276,68,227723,203,44,227755,281,73,227895,291,77,228104,88,35,228109,203,68,228265,213,73,228401,250,44,228427,322,77,228593,229,35,228739,88,80,228765,223,73,228869,145,44,229083,380,77,229098,83,80,229223,260,47,229416,270,35,229432,281,80,229432,317,85,229437,296,73,229437,322,77,229458,78,85,229838,520,80,229859,83,73,229859,119,77,229875,229,44,229895,223,33,230390,223,49,230593,130,51,230661,140,54,230744,276,45,230791,260,57,230875,239,61,231098,88,33,231119,255,61,231296,140,45,231468,260,66,231473,130,69,231703,364,73,231796,67,33,231817,255,73,231973,333,78,232151,260,45,232239,208,81,232276,203,78,232515,276,73,232520,291,85,232520,312,33,232526,322,85,232906,78,73,232911,72,78,232937,197,45,232963,239,33,233333,296,49,233494,218,52,233666,270,45,233755,260,55,233854,197,61,234041,72,33,234098,296,61,234208,255,64,234390,276,45,234520,270,67,234578,260,73,234770,78,33,234848,296,73,234958,270,76,235151,78,45,235270,234,79,235296,119,79,235552,171,73,235557,208,85,235562,276,45,235562,296,33,235578,291,79,236000,88,85,236010,104,73,236015,296,45,236041,359,33,236041,354,80,236515,57,72,236515,161,84,236515,161,44,236526,213,32,236536,145,82,236619,250,60,237177,182,56,237192,218,68,237203,255,80,237401,208,68,237593,302,60,237677,250,80,237791,234,61,237968,265,70,237989,223,80,238177,776,72,238380,239,63,238421,401,80,238583,291,73,238770,223,64,238791,494,80,238953,276,75,239151,265,66,239197,447,80,239333,223,72,239520,229,63,239562,515,80,239729,343,75,239906,255,66,239947,505,80,240119,218,73,240286,3411,64,240328,359,80,240484,270,78,240645,385,69,240708,187,80,240875,463,76,241031,286,68,241083,354,80,241250,192,75,241406,255,66,241437,281,80,241609,218,73,241812,197,64,241828,208,80,241979,406,72,242187,208,63,242234,250,80,242333,276,69,242583,109,61,242583,208,79,242791,161,56,242953,93,60,242963,171,68,242973,244,80,243171,182,68,243375,234,60,243390,218,80,243557,130,68,243781,333,60,243791,260,80,243968,182,70,244166,260,61,244182,515,80,244364,197,72,244583,375,63,244604,229,80,244760,276,73,244973,213,64,244973,458,80,245166,229,75,245354,250,66,245375,421,80,245541,208,72,245723,208,63,245723,447,80,245916,312,66,246083,416,75,246104,203,80,246317,239,73,246447,3786,64,246463,406,80,246645,270,78,246822,375,69,246854,213,80,247052,447,76,247187,281,68,247229,354,80,247406,234,75,247578,260,66,247583,291,80,247776,203,73,247958,213,64,247963,385,80,248151,156,72,248333,218,63,248354,578,61,248671,88,69,248703,171,79,248901,130,60,249057,83,56,249067,83,68,249072,203,80,249265,145,61,249437,83,69,249437,88,56,249458,166,79,249609,145,60,249796,88,68,249807,88,56,249822,234,80,249994,255,61,250145,98,56,250171,156,69,250177,213,79,250348,125,60,250520,88,68,250541,130,56,250541,229,70,250625,151,80,250703,223,61,250864,98,69,250875,130,56,250880,187,79,251041,213,60,251213,104,56,251229,151,68,251255,307,80,251463,104,56,251630,119,61,251635,286,69,251645,187,79,251770,88,80,251994,104,60,252005,145,68,252010,135,56,252010,156,44,253010,2562,56,253020,2593,32,253020,2708,37,257098,83,44,257255,380,49,257437,234,52,257630,125,56,257744,130,37,257817,98,49,257916,208,52,258083,151,44,258119,250,56,258281,255,61,258458,104,37,258500,98,52,258651,109,44,258796,145,56,258802,281,61,258994,78,64,259135,104,37,259161,270,56,259312,218,44,259458,166,61,259479,291,64,259677,203,68,259796,130,37,259817,119,61,259906,276,64,260093,135,44,260177,260,68,260286,208,73,260458,98,37,260489,130,64,260604,229,68,260755,135,44,260807,260,73,260937,78,76,261072,213,37,261119,255,76,261244,234,80,261406,114,44,261447,239,85,261593,312,76,261755,213,88,261765,260,49,261770,296,37,261786,296,88,262208,67,76,262229,125,44,262229,229,34,262781,229,52,263031,239,55,263197,187,49,263229,239,61,263380,307,64,263572,135,46,263598,171,55,263744,223,61,263890,239,49,263927,333,64,264088,203,46,264286,140,67,264296,187,61,264427,218,49,264609,244,64,264614,265,67,264796,265,46,264984,177,73,264989,276,64,265197,182,49,265302,239,67,265343,260,73,265526,270,76,265682,223,46,265687,276,67,265875,229,73,266015,208,49,266020,317,76,266177,239,79,266359,72,46,266395,255,73,266526,270,76,266687,161,49,266708,244,79,266854,218,85,267020,270,46,267067,244,76,267192,291,79,267375,104,49,267395,239,85,267520,67,88,267744,385,76,267750,203,46,267755,265,34,267786,276,88,268145,88,49,268171,130,76,268182,125,31,268687,192,51,268932,234,58,269156,166,51,269218,286,61,269369,338,63,269583,114,43,269598,156,58,269760,255,51,269932,234,61,269947,239,63,270125,229,70,270312,114,43,270354,385,61,270479,250,63,270661,213,51,270677,270,70,270875,135,73,271041,307,43,271046,338,63,271234,203,51,271385,234,70,271395,317,73,271588,312,75,271776,229,43,271796,260,70,271958,223,73,272119,255,51,272130,281,75,272291,291,82,272500,135,43,272520,302,73,272661,244,51,272864,208,75,272864,296,82,273052,265,43,273229,255,85,273239,317,82,273437,302,75,273645,187,51,273656,250,73,273807,244,82,274062,276,43,274072,432,75,274291,291,73,274520,218,51,274526,223,70,274723,302,71,275046,151,44,275052,484,51,275375,598,47,275619,229,51,275911,265,75,276291,442,44,276328,171,47,276817,171,51,277031,161,44,277239,156,51,277458,166,47,277656,182,51,277859,1932,71,278015,151,44,278104,125,51,278395,713,68,278515,161,47,278635,135,67,278750,145,68,278875,239,51,278875,1046,70,279041,260,68,279156,140,46,279192,578,51,279479,177,49,279661,145,51,279916,1208,67,280052,187,46,280140,421,51,280317,192,49,280536,208,51,280729,197,46,280984,1145,51,281223,213,67,281427,161,49,281500,145,51,281750,588,75,281942,156,46,281953,166,51,282187,677,49,282427,140,67,282661,151,51,282671,109,47,282848,1046,70,282880,182,51,283083,130,47,283328,213,51,283494,156,47,283697,1156,68,283765,177,51,283911,151,47,284130,223,51,284317,192,47,284526,1098,51,284734,265,68,284968,161,47,284984,208,51,285244,505,75,285421,166,47,285468,218,51,285708,203,47,285906,869,51,286083,276,68,286104,291,43,286333,187,71,286343,291,51,286536,151,43,286796,208,51,287000,140,43,287260,1145,70,287286,182,51,287489,140,43,287723,208,51,287916,156,43,288125,1067,51,288322,239,70,288541,151,43,288588,223,51,288854,661,75,289119,187,43,289145,151,51,289421,161,43,289651,760,70,289833,151,51,289921,151,71,290098,234,44,290130,145,51,290453,473,87,290697,130,75,290703,510,51,290968,531,44,291119,140,51,291354,151,47,291562,145,87,291567,140,75,291572,526,51,291791,541,44,291994,151,51,292208,140,75,292416,88,87,292421,98,47,292442,130,51,292687,145,83,292859,72,71,292875,83,44,292880,192,51,293119,145,68,293281,114,80,293281,114,47,293312,125,51,293520,229,80,293718,171,68,293723,223,46,293744,239,51,293958,234,49,294182,130,79,294208,192,67,294213,473,51,294395,520,46,294598,151,51,294807,218,67,295046,156,79,295052,192,49,295052,510,51,295244,130,46,295447,541,51,295640,244,67,295890,78,79,295895,98,49,295895,145,51,296098,208,87,296333,109,75,296333,145,46,296359,156,51,296546,218,79,296765,78,67,296765,83,49,296770,182,51,296979,213,82,297208,109,47,297208,197,70,297208,223,51,297385,234,47,297651,114,80,297666,208,68,297671,98,51,297843,500,47,298067,520,51,298244,218,80,298453,104,68,298468,234,47,298479,411,51,298645,458,47,298854,125,51,299036,213,80,299250,72,68,299250,135,47,299265,125,51,299453,234,87,299661,62,75,299666,83,47,299682,166,51,299875,260,68,300062,88,80,300062,218,47,300093,255,51,300291,281,83,300515,88,71,300520,166,43,300536,156,51,300723,234,82,301005,171,43,301005,250,70,301010,104,51,301213,557,43,301458,572,51,301625,281,82,301838,161,70,301838,270,43,301864,536,51,302052,541,43,302270,182,51,302458,255,70,302625,119,82,302630,223,43,302651,223,51,302859,78,43,303041,291,75,303052,145,87,303052,229,51,303270,250,70,303453,145,43,303458,192,82,303458,208,51,303666,213,84,303895,317,72,303895,182,42,303895,223,51,304135,203,44,304270,234,51,304505,213,42,304718,1270,51,304932,1276,44,305125,234,51,305328,223,85,305552,197,73,305557,229,40,305588,651,49,305791,239,44,305994,807,49,306182,223,40,306390,197,49,306588,213,44,306791,244,49,307036,213,70,307229,182,82,307234,255,40,307270,354,83,307364,265,49,307479,270,82,307541,276,42,307739,973,80,307739,229,82,307958,625,49,308015,458,83,308260,328,71,308265,223,39,308270,255,47,308500,213,42,308687,239,47,308885,229,39,309119,260,47,309322,218,42,309510,1859,47,309729,1864,39,309947,229,47,310130,208,42,310354,250,47,310562,239,80,310786,312,68,310791,208,38,310812,218,47,311041,239,40,311218,229,47,311437,234,38,311661,1395,47,311890,1421,40,312125,125,41,312171,130,47,312291,223,81,312484,270,69,312484,244,37,312520,213,45,312718,229,40,312916,197,45,313104,223,37,313322,1286,45,313505,1406,40,313744,218,45,313890,208,67,314213,93,79,314213,328,37,314229,208,46,314437,270,80,314479,630,39,314666,447,77,314786,354,46,314958,229,79,314958,401,78,315208,203,68,315250,312,35,315250,218,80,315250,281,44,315479,229,39,315692,208,44,315895,218,35,316109,270,44,316333,276,39,316510,187,44,316729,1968,35,316958,2052,44,317135,229,39,317390,156,44,317541,125,81,318015,791,69,318015,802,73,318015,812,76,318020,833,49,318020,859,40,318020,1020,45,318020,1057,37,318031,2062}) curPat=1 patTmr=0 noteReset=true major={0, 2, 4, 5, 7, 9, 11, 12} minor={0, 2, 3, 5, 7, 8, 10, 12} hMajor={0, 2, 4, 5, 7, 8, 11, 12} hMinor={0, 2, 3, 5, 7, 8, 11, 12} startOct=3 startName="G dur" startN=0 startAdd=0 scale={} hScale={} function BOOT() trace("bye!") startN=startOct*12 for i=1, #nNames do if startName:sub(1, 1) == nNames[i] then startN=startN+major[i] break end end if startName:sub(1, 1) == "B" then startN=startN+10 end if startName:sub(2, 3) == "es" or startName:sub(1, 2) == "As" or startName:sub(1, 2) == "Es" then startAdd=-1 end if startName:sub(2, 3) == "is" then startAdd=1 end startN=startN+startAdd if startName:sub(startName:len()-2, startName:len()) == "dur" then initScale(major, hMajor, startN) else initScale(minor, hMinor, startN) end pat[curPat].func(scale, hScale) end function TIC() while curPat < #pat and time()-patTmr>pat[curPat].len do curPat=curPat+1 patTmr=time()-1/60 if noteReset then stopAll() end pat[curPat].func(scale, hScale) end cls(0) for o=-1, 8 do local off = o*12 for i=1, 12 do local pl = false for i1=1, 4 do if pNotes[i1]==i+off then pl = true end end drawNote(i+off, pl) end for j=1, #black do local i = black[j] local pl = false for i1=1, 4 do if pNotes[i1]==i+off then pl = true end end drawNote(i+off, pl) end end local curSum = 0 for i=curPat, curPat+50 do if pat[i] ~= nil then local pos = pat[i].vis() for j=1, #pos do local posX = (-time()+patTmr+curSum)/20+w/2 line(posX, h-(pos[j]+10), posX+pat[i].len/20, h-(pos[j]+10), i == curPat and 4 or 5) end curSum = curSum + pat[i].len end end local curSum = 0 for i=curPat-1, curPat-50, -1 do if pat[i] ~= nil then local pos = pat[i].vis() for j=1, #pos do local posX = (-time()+patTmr+curSum)/20+w/2 line(posX, h-(pos[j]+10), posX-pat[i].len/20, h-(pos[j]+10), 9) end curSum = curSum - pat[i].len end end line(w/2, 0, w/2, h-11, 13) print("Current scale: "..startName) print("Current notes playing:", 0, 10) print(pNotes[1], 0, 17) print(pNotes[2], 0, 24) print(pNotes[3], 0, 31) print(pNotes[4], 0, 38) end function initScale(start, hStart, base) scale={} hScale={} for i=1, #start do scale[i]=start[i]+base hScale[i]=hStart[i]+base end end pNotes = {} cNote = 0 function playNote(scale, note, add) sfx(0, scale[note]+add, -1, cNote, 10) pNotes[cNote+1]=scale[note]+add cNote=(cNote+1)%4 end function stopAll() sfx(0, 0, 0, 0) pNotes[1]=nil sfx(0, 0, 0, 1) pNotes[2]=nil sfx(0, 0, 0, 2) pNotes[3]=nil sfx(0, 0, 0, 3) pNotes[4]=nil end black={1, 3, 6, 8, 10} function drawNote(note, playing) blackN = false local posX = note*2+note//12*2*2 for i=1, #black do if note%12 == black[i] then blackN = true end end if note%12 >= 5 then posX=posX+2 end local col = playing and 2 or 12 local colB = playing and 1 or 15 if blackN then rect(posX, h-10, 3, 5, colB) else rect(posX, h-10, 3, 10, col) --rectb(posX, h-10, 4, 10, col+1) end end nNames = {"C", "D", "E", "F", "G", "A", "H"}