'Earl Brown - december 1952 'interprets december1952_score.dat, derived from scanned score with helper programs - see info.txt in december1952 dir %D1952main = 32 TYPE D1952_blok x AS LONG xx AS LONG y AS LONG yy AS LONG b AS LONG 'width h AS LONG 'height s AS LONG 'surface 'now we use some of the originally reserved bytes strt AS INTEGER 'relative starttime in promile stp AS INTEGER ' stop ins AS INTEGER 'instrument for this event dummy AS STRING * 2 '2 bytes reserved left END TYPE GLOBAL D1952_Instr() AS musician GLOBAL gmtstartcptr AS DWORD DECLARE FUNCTION InitDec1952 AS LONG DECLARE SUB PlayDec192 DECLARE SUB StartDec1952 DECLARE SUB Dec1952_Piper_Silence FUNCTION InitDec1952 AS LONG DIM D1952_Instr(5) GetInstrumentParams D1952_Instr(1), %ID_VIBI SetRobotPort D1952_Instr(1), "", hMidiO() GetInstrumentParams D1952_Instr(2), %IDM_TROMS SetRobotPort D1952_Instr(2), "", hMidiO() GetInstrumentParams D1952_Instr(3), %ID_PIPEROLA D1952_Instr(3).lowtes = 36 'add bourdon SetRobotPort D1952_Instr(3), "", hMidiO() GetInstrumentParams D1952_Instr(4), %ID_THUNDERWOOD SetRobotPort D1952_Instr(4), "", hMidiO() GetInstrumentParams D1952_Instr(5), %ID_BELLY SetRobotPort D1952_Instr(5), "", hMidiO() Task(%D1952main).naam = "PlayIt" Task(%D1952main).freq = 10 Task(%D1952main).cptr = CODEPTR(PlayDec1952) Modemess D1952_Instr(1).channel, 20, 30 Modemess D1952_Instr(1).channel, 21, 40 Modemess D1952_Instr(1).channel, &H40, 1 Modemess D1952_Instr(5).channel, &H44, 0 gmtstartcptr = ButnSW(1).cptr ButnSW(1).cptr = CODEPTR(StartDec1952) ButnOS(2).tag = "PipPanic" ButnOS(2).cptr = CODEPTR(Dec1952_Piper_silence) ' MSGBOX STR$(ButnOS(2).cptr) FUNCTION = %true END FUNCTION SUB PlayDec1952 STATIC bl() AS D1952_Blok STATIC blf() AS D1952_Blok 'blok off (to be able to sort times) STATIC this AS LONG STATIC oncount AS LONG STATIC offcount AS LONG STATIC ihar() AS HarmType LOCAL f AS LONG LOCAL i AS LONG LOCAL note AS BYTE LOCAL velo AS BYTE LOCAL trom AS BYTE IF ISFALSE this THEN this = %D1952main REDIM bl(32) REDIM blf(32) REDIM ihar(5) f = FREEFILE OPEN "c:\b\pb\gmt\kristof\december1952\december1952_score.dat" FOR BINARY ACCESS READ LOCK WRITE AS f IF ERRCLEAR THEN MSGBOX "couldn't find december1952_score.dat",,FUNCNAME$ StopTask this END IF GET #f,,bl() SEEK #f, 1 GET #f,,blf() CLOSE f DIM dum(32) AS LOCAL LONG FOR i = 0 TO 32 dum(i) = blf(i).stp NEXT ARRAY SORT dum(), TAGARRAY blf() ' LOCAL b$ ' FOR i = 0 TO 32 ' b$ = b$ + STR$(i) + STR$(blf(i).stp) + STR$(blf(i).strt) + $CRLF ' NEXT ' MSGBOX b$ Task(this).freq = 10 EXIT SUB END IF IF getpromil > 1000 THEN StopTask this 'add allnotesoff ! RESET bl() RESET this RESET oncount RESET offcount RESET ihar() END IF IF (oncount < UBOUND(bl)) AND (bl(oncount).strt <= getpromil) THEN CONTROL SET TEXT gh.cockpit, %GMT_MSG1, STR$(oncount) + " -" + STR$(bl(oncount).strt) + " >" + STR$(getpromil) CONTROL SET TEXT gh.cockpit, %GMT_AUTHOR, "ins" + STR$(bl(oncount).ins) 'event on SELECT CASE bl(oncount).ins CASE 1 'vibi 'linear mapping to onepitch [28, 804] > ins.range, velo mapping [1, 4] > [12, 60] note = D1952_Instr(1).lowtes + ( (bl(oncount).y - 28) / 776! ) * (D1952_Instr(1).hightes - D1952_Instr(1).lowTes) velo = 12 + 12 * bl(oncount).h AddNote2Har ihar(1), note, velo 'do tremolo on this har CASE 2 'troms 'pitches [28, 804] > trom[0-6] trom = 6! * ((bl(oncount).y) - 28)/776! velo = bl(oncount).h - 3 SELECT CASE trom CASE 0: note = 95 CASE 1: note = 63 CASE 2: note = 111 CASE 3: note = 119 CASE 4: note = 127 CASE 5: note = 1 CASE 6: note = 2 END SELECT CONTROL SET TEXT gh.cockpit, %GMT_TITLE, "TROMS:" + STR$(trom) + "=" + STR$(note) + STR$(velo) mPlay D1952_Instr(2).channel, note, 24 Keypress D1952_Instr(2).channel, note, 100 + 4 * bl(oncount).h CASE 3 'piper/bourd 'cluster, [28, 804] > piper_boourd.range FOR i = bl(oncount).y TO bl(oncount).yy note = D1952_Instr(3).lowtes + ( (i - 28)/776! ) * (D1952_Instr(3).hightes - D1952_Instr(3).lowTes) AddNote2Har ihar(3), note, 64 AddNote2Har ihar(3), note + 12, 64 AddNote2Har ihar(3), note - 12, 64 NEXT D1952_Instr(3).Har(1) = ihar(3) InstrumPlay D1952_Instr(3) CASE 4 'thunderwood '.h = [6 - 57] > tw.components trom = 7 * (bl(oncount).h - 6)/51! CONTROL SET TEXT gh.cockpit, %GMT_TITLE, "TW:" + STR$(trom) SELECT CASE trom CASE 0, 6 'storm & wind mPlay D1952_Instr(4).channel, 25, 127 mPlay D1952_Instr(4).channel, 24, 127 '70 + bl(oncount).h CASE 1 TO 4 'pekkers + ratchet + thunder trom = 4 + 3 * (trom - 1) mPlay D1952_Instr(4).channel, trom, 127 - (bl(oncount).h)/2 Keypress D1952_Instr(4).channel, trom, 70 + bl(oncount).h mPlay D1952_Instr(4).channel, 19, 127 - (bl(oncount).h)/2 Keypress D1952_Instr(4).channel, 19, 70 + bl(oncount).h AddNote2Har ihar(4), 15, 50 CASE 5 'thundersheet ' msgbox "thunder!" mPlay D1952_Instr(4).channel, 19, 127 - (bl(oncount).h)/2 Keypress D1952_Instr(4).channel, 19, 70 + bl(oncount).h CASE 7 'ratchet + thunder AddNote2Har ihar(4), 15, 50 mPlay D1952_Instr(4).channel, 19, 127 - (bl(oncount).h)/2 Keypress D1952_Instr(4).channel, 19, 70 + bl(oncount).h END SELECT CASE 5 'belly FOR i = bl(oncount).y TO bl(oncount).yy note = D1952_Instr(5).lowtes + ( (i - 28)/776! ) * ((D1952_Instr(5).hightes - 28) - D1952_Instr(5).lowTes) CONTROL SET TEXT gh.cockpit, %GMT_TITLE, "BELLY:" + STR$(note) AddNote2Har ihar(5), note, 1 AddNote2Har ihar(5), note + 14, 1 AddNote2Har ihar(5), note + 28, 1 NEXT PlayHar ihar(5), D1952_Instr(5).channel 'oneshot!! - that's why it's here.. ihar(5).vel = STRING$(128, 0) 'avoid repeat END SELECT INCR oncount END IF 'now handle offcount 'don't erase complete hars - an ins may be playing more then one event at a time! IF blf(offcount).stp <= getpromil THEN 'event off CONTROL SET TEXT gh.cockpit, %GMT_MSG2, STR$(offcount) + " -" + STR$(bl(offcount).strt) + " >" + STR$(getpromil) SELECT CASE blf(offcount).ins CASE 1 'vibi 'don't just erase the har - allow event polyfony.. note = D1952_Instr(1).lowtes + ( (blf(offcount).y - 28) / 776! ) * (D1952_Instr(1).hightes - D1952_Instr(1).lowTes) DelNote2Har ihar(1), note CASE 2 trom = 6! * (blf(offcount).y - 28)/776! SELECT CASE trom CASE 0: note = 95 CASE 1: note = 63 CASE 2: note = 111 CASE 3: note = 119 CASE 4: note = 127 CASE 5: note = 1 CASE 6: note = 2 END SELECT CONTROL SET TEXT gh.cockpit, %GMT_TITLE, "TROMSoff:" + STR$(trom) + "=" + STR$(note) mPlay D1952_Instr(2).channel, note, 0 CASE 3 FOR i = blf(offcount).y TO blf(offcount).yy note = D1952_Instr(3).lowtes + ( (i - 28)/776! ) * (D1952_Instr(3).hightes - D1952_Instr(3).lowTes) DelNote2Har ihar(3), note DelNote2Har ihar(3), note + 12 DelNote2Har ihar(3), note - 12 NEXT D1952_Instr(3).har(1) = ihar(3) InstrumPlay D1952_Instr(3) CONTROL SET TEXT gh.cockpit, %GMT_TITLE, "PIPERoff" CASE 4 'thunderwood '.h = [6 - 57] trom = 7 * (blf(offcount).h - 6)/51! SELECT CASE trom CASE 0, 6 'storm & wind mPlay D1952_Instr(4).channel, 25, 0 mPlay D1952_Instr(4).channel, 24, 0 CASE 1 TO 4 'pekkers trom = 4 + 3 * (trom - 1) mPlay D1952_Instr(4).channel, trom, 0 mPlay D1952_Instr(4).channel, 19, 0 DelNote2Har ihar(4), 15 CASE 5 'Thundersheet ' msgbox "thunder off" mPlay D1952_Instr(4).channel, 19, 0 CASE 7 'ratchet + thunder DelNote2Har ihar(4), 15 mPlay D1952_Instr(4).channel, 19, 0 END SELECT 'don't bother about case 5 - belly END SELECT INCR offcount IF offcount > UBOUND(blf) THEN stoptask this: this = 0 END IF FOR i = 1 TO 5 D1952_Instr(i).Har(1) = ihar(i) NEXT 'handle playing for: vibi = tremolo, piperbourd=onoff InstrumPlay D1952_Instr(1) 'plays har(1) and resets InstrumPlay D1952_Instr(1) 'clear instrumplay memory, so we replay this next time InstrumPlay D1952_Instr(4) 'for ratchet only InstrumPlay D1952_Instr(4) 'for ratchet only END SUB SUB StartDec1952 App.komposduur = 360 IF ButnSW(1).cptr THEN CALL DWORD gmtstartcptr StartTask %D1952main 'msgbox "start ok",, funcname$ END SUB SUB Dec1952_Piper_Silence LOCAL n AS BYTE FOR n = 60 TO 127 'dont forget percussion.. mPlay D1952_Instr(3).channel, n, 0 SLEEP 10 NEXT END SUB