Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/sdlbrt
- finp$="PenguinAdventure_03_ForestPath.vgm"
- fout$=finp$+".txt"
- ltxtm$="....|..|--- .... ....|--- .... ....|--- .... ...."
- qtx$=ltxtm$
- frmc=0:frmi=735:frmr=200
- trg=0:freqq=0:debug=0
- freq0=0:freq1=0:freq2=0
- vol0=0:vol1=0:vol2=0
- patam=64:patc=0:patid=0
- '- fix: 0x0FE=440hz=A-4
- 'a-4 =0x0FE
- function nttfrq$(b)
- a$= "3424,3232,3050,2880,2714,2562,2418,2282,2154,2034,1922,1814,"
- a$=a$+"1712,1616,1525,1440,1357,1281,1209,1141,1077,1017, 961, 907,"
- a$=a$+" 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453,"
- a$=a$+" 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226,"
- a$=a$+" 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113,"
- a$=a$+" 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56,"
- a$=a$+" 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 30, 28,"
- a$=a$+" 26, 25, 23, 22, 21, 20, 18, 17, 16, 15, 15, 14,"
- fl=0:tmpr=0
- for c=1 to 96
- d=val(mid$(a$,((c-1)*5)+1,4))
- if ((b<(d+(d/35)))and(b>(d-(d/35)))and(fl=0)) then:fl=1:tmpr=c:end if:next
- if b=0 then:tmpr=0:end if
- '- correct notation?
- e$="B-8C-2C#2D-2D#2E-2F-2F#2G-2G#2A-2A#2B-2"
- e$=e$+"C-3C#3D-3D#3E-3F-3F#3G-3G#3A-3A#3B-3"
- e$=e$+"C-4C#4D-4D#4E-4F-4F#4G-4G#4A-4A#4B-4"
- e$=e$+"C-5C#5D-5D#5E-5F-5F#5G-5G#5A-5A#5B-5"
- e$=e$+"C-6C#6D-6D#6E-6F-6F#6G-6G#6A-6A#6B-6"
- e$=e$+"C-7C#7D-7D#7E-7F-7F#7G-7G#7A-7A#7B-7"
- e$=e$+"C-8C#8D-8D#8E-8F-8F#8G-8G#8A-8A#8B-8"
- tmpz$=mid$(e$,(tmpr*3)+1,3):nttfrq$=tmpz$:end function
- dim hdrv[256]
- open finp$ for input as #1
- for i=0 to 255
- hdrv[i]=readbyte(1)
- next
- close #1
- open finp$ for input as #1
- open fout$ for output as #2
- print #2,"[Module]"
- print #2,"VortexTrackerII=1"
- print #2,"Version=3.6"
- print #2,"Title="
- print #2,"Author="
- print #2,"NoteTable=1"
- print #2,"Speed=3"
- print #2,"PlayOrder=L0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47"
- print #2," "
- print #2,"[Ornament1]"
- print #2,"L0"
- print #2," "
- print #2,"[Sample1]"
- print #2,"Tne +000_ +00_ D- L"
- print #2," "
- print #2,"[Pattern0]"
- '- read 256 dummy bytes from the header - i have to know how to deal with this better later
- for eee=0 to 0x7F:q0=readbyte(1):next '- read offset byte first
- txou1$=" #("+str$(0)+")"
- while eof(1)=0
- q0=readbyte(1)
- if bitwiseand(q0,0x70)=0x70 then
- frmc=frmc+bitwiseand(q0,0xF)+1
- txou1$=" #("+str$(frmc)+")"
- end if
- if q0=0x61 then
- q0=readbyte(1)
- frmc=frmc+q0
- q0=readbyte(1)
- frmc=frmc+(q0*256)
- txou1$=" #("+str$(frmc)+")"
- end if
- if q0=0x62 then
- frmc=frmc+735
- txou1$=" #("+str$(frmc)+")"
- end if
- while frmr<frmc
- if patc>(patam-1) then:
- print #2," "
- patid=patid+1:patc=0
- txou9$="[Pattern"+str$(patid)+"]"
- print #2,txou9$
- end if
- if debug=1 then:print #2,txou1$:end if
- if trg=0 then
- qtx$=ltxtm$
- print #2,qtx$
- else
- print #2,qtx$
- qtx$=ltxtm$
- trg=0
- end if
- frmr=frmr+frmi
- patc=patc+1
- end while
- if q0=0xA0 then
- q0=readbyte(1)
- if q0=0 then
- q0=readbyte(1)
- freq0= bitwiseor ( (bitwiseand(freq0,0xF00)),(bitwiseand(q0,0x0FF)) )
- ltxtm1$=qtx$
- ltxtm2$=left$(ltxtm1$,8)+ nttfrq$(freq1) +right$(ltxtm1$,38)
- qtx$=ltxtm2$
- trg=1
- end if
- if q0=1 then
- q0=readbyte(1)
- freq0= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq0,0x0FF)) )
- ltxtm1$=qtx$
- ltxtm2$=left$(ltxtm1$,8)+ nttfrq$(freq1) +right$(ltxtm1$,38)
- qtx$=ltxtm2$
- trg=1
- end if
- if q0=2 then
- q0=readbyte(1)
- freq1= bitwiseor ( (bitwiseand(freq1,0xF00)),(bitwiseand(q0,0x0FF)) )
- ltxtm1$=qtx$
- ltxtm2$=left$(ltxtm1$,22)+ nttfrq$(freq1) +right$(ltxtm1$,24)
- qtx$=ltxtm2$
- trg=1
- end if
- if q0=3 then
- q0=readbyte(1)
- freq1= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq1,0x0FF)) )
- ltxtm1$=qtx$
- ltxtm2$=left$(ltxtm1$,22)+ nttfrq$(freq1) +right$(ltxtm1$,24)
- qtx$=ltxtm2$
- trg=1
- end if
- if q0=4 then
- q0=readbyte(1)
- freq2= bitwiseor ( (bitwiseand(freq2,0xF00)),(bitwiseand(q0,0x0FF)) )
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,36)+ nttfrq$(freq1) +right$(ltxtm1$,10)
- qtx$=ltxtm2$
- trg=1
- end if
- if q0=5 then
- q0=readbyte(1)
- freq2= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq2,0x0FF)) )
- ltxtm1$=qtx$
- ltxtm2$=left$(ltxtm1$,36)+ nttfrq$(freq1) +right$(ltxtm1$,10)
- qtx$=ltxtm2$
- trg=1
- end if
- 'if q0=6 then
- ' print #2,ltxtm$
- ' end if
- 'if q0=7 then
- ' q0=readbyte(1)
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,31)+ right$(bin$(512+q0),8) +right$(ltxtm1$,2)
- ' print #2,ltxtm2$
- ' trg=1
- ' end if
- if q0=8 then
- q0=readbyte(1)
- vol0= bitwiseand(q0,0xF)
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,15)+ ucase$( right$(hex$(0x10+vol0),1) ) +right$(ltxtm1$,33)
- qtx$=ltxtm2$
- trg=1
- end if
- if q0=9 then
- q0=readbyte(1)
- vol1= bitwiseand(q0,0xF)
- ltxtm1$=qtx$
- ltxtm2$=left$(ltxtm1$,29)+ ucase$( right$(hex$(0x10+vol1),1) ) +right$(ltxtm1$,19)
- qtx$=ltxtm2$
- trg=1
- end if
- if q0=10 then
- q0=readbyte(1)
- vol2= bitwiseand(q0,0xF)
- ltxtm1$=qtx$
- ltxtm2$=left$(ltxtm1$,43)+ ucase$( right$(hex$(0x10+vol2),1) ) +right$(ltxtm1$,5)
- qtx$=ltxtm2$
- trg=1
- end if
- end if
- wend
- close #1:close #2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement