home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
LEDGERS
/
LEDG_07B.MSA
/
SOURCE
/
MR_MUSIC.V2
/
QUARCON2.GFA
(
.txt
)
< prev
next >
Wrap
GFA-BASIC Atari
|
1985-11-20
|
5KB
|
146 lines
' -----------------------------------------------------------------------------'
' Quartet to MR Music Convertor By Martin Griffiths '
' -----------------------------------------------------------------------------'
' Version 0.9 - Almost complete version which handles everything except slides.
' Version 1.0 - All functions converted.
CLS
PRINT AT(24,2);"---------------------------------------"
PRINT AT(24,3);"Quartet 4V to Mr Music File Convertor!!"
PRINT AT(24,4);" Full convertor (in theory!!!)"
PRINT AT(24,6);" Written in GFA Basic V3.02!"
PRINT AT(24,7);" By Martin Griffiths"
PRINT AT(24,8);"---------------------------------------"
PRINT AT(27,22);"Please Press any key to Continue"
a&=INP(2)
DIM match_freq%(64)
DIM loop_ptrs%(100) !store for upto 100 depth loop
DIM input_buf%(12000) !50k input buffer
DIM output_buf%(12000) !50k output buffer
DIM voiceset_buf%(30000),loop_flag&(19)
RESTORE
FOR i&=0 TO 59
READ match_freq%(i&)
NEXT i&
input_ptr%=V:input_buf%(0) !ptr to input buffer
output_ptr%=V:output_buf%(0) !ptr to output buffer
CLS
PRINT " Please select a Quartet 4V to Convert!"
PRINT " --------------------------------------"
REPEAT
FILESELECT "\*.4V",f$,f$
UNTIL RIGHT$(f$,3)=".4V" OR f$=""
IF f$=""
END
ENDIF
BLOAD f$,input_ptr%
CLS
PRINT AT(19,1);"Please Select accompanying Quartet .SET file"
PRINT AT(19,2);"--------------------------------------------"
FILESELECT "\*.SET",voiceset_name$,voiceset_name$
IF voiceset_name$=""
END
ENDIF
BLOAD voiceset_name$,V:voiceset_buf%(0)
FOR i&=0 TO 19
i%=V:voiceset_buf%(0)+LPEEK(V:voiceset_buf%(0)+&H8E+SHL(i&,2))
IF DPEEK(i%)=65535
loop_flag&(i&)=FALSE
ELSE
loop_flag&(i&)=TRUE
ENDIF
NEXT i&
CLS
ADD input_ptr%,16
CLR curr_note&,curr_instrument&,curr_sustain&,loopsize&,loop_depth&
' Conversion loop
FOR ch&=1 TO 4 !loop for 4 channels
PRINT AT(1,3);"Working on channel:";ch&
DO
command_read&=DPEEK(input_ptr%)
EXIT IF command_read&=70 !exit if 'F' - end of chan
SELECT command_read&
CASE 108 !'l' - beginning of a loop
loop_ptrs%(loop_depth&)=output_ptr%
INC loop_depth&
CASE 76 !'L' - end of a loop
loop&=DPEEK(input_ptr%+8) !no of loops -1
DEC loop_depth&
DPOKE output_ptr%,-128 !signify loop
POKE output_ptr%+2,loop&
POKE output_ptr%+3,loop&
loopsize&=(output_ptr%+4)-loop_ptrs%(loop_depth&) !loopsize
DPOKE output_ptr%+4,loopsize&
ADD output_ptr%,6
CASE 83 !'S' - Slide!
DPOKE output_ptr%,4+curr_sustain& !bit 2 set(4!!)
note%=LPEEK(input_ptr%+4)
FOR i&=0 TO 59
EXIT IF note%=match_freq%(i&)
NEXT i&
d&=DPEEK(input_ptr%+2)/4 !slide duration
diff&=ABS(i&-curr_note&)
DPOKE output_ptr%+2,i& !Destination note
IF diff&=0
DPOKE output_ptr%+4,1
ELSE IF d&/diff&<2
DPOKE output_ptr%+4,1
ELSE
DPOKE output_ptr%+4,2
ENDIF
DPOKE output_ptr%+6,d& ! vbl count(slide duration)
ADD output_ptr%,8
curr_note&=i&
CASE 86 !'V' - New instrument
curr_instrument&=DPEEK(input_ptr%+10)/4
IF loop_flag&(curr_instrument&)=TRUE
curr_sustain&=16384
ELSE
CLR curr_sustain&
ENDIF
CASE 80 !'P' - New note
DPOKE output_ptr%,3+curr_sustain& !bits 0 and 1 set=3
DPOKE output_ptr%+2,curr_instrument&
note%=LPEEK(input_ptr%+4)
FOR i&=0 TO 59
EXIT IF note%=match_freq%(i&)
NEXT i&
DPOKE output_ptr%+4,i&
curr_note&=i&
DPOKE output_ptr%+6,DPEEK(input_ptr%+2)/4 ! duration/4
ADD output_ptr%,8
CASE 82 !'R' - Rest
DPOKE output_ptr%,8
DPOKE output_ptr%+2,DPEEK(input_ptr%+2)/4 !store vbl count(200hz cnt/4)
ADD output_ptr%,4
DEFAULT
ENDSELECT
ADD input_ptr%,12 !advance to quartet's next command
LOOP
DPOKE output_ptr%,-9999
ADD output_ptr%,2
ADD input_ptr%,12 !advance to quartet's next command
NEXT ch&
new_length%=output_ptr%-V:output_buf%(0)
PRINT "Original Length:";input_ptr%-V:input_buf%(0)
PRINT "New Length:";new_length%
FILESELECT "\*.SNG",f$,f$
BSAVE f$,V:output_buf%(0),new_length%
' Quartet to Mr music frequency match table
table:
DATA &000000,&000000,&000000,&000000
DATA &000000,&000000,&000000,&000000
DATA &000000,&000000,&004C1B,&0050A2
DATA &00556E,&005A82,&005FE4,&006597
DATA &006BA2,&007208,&0078D0,&008000
DATA &00879C,&008FAC,&009837,&00A145
DATA &00AADC,&00B504,&00BFC8
DATA &00CB2F,&00D744,&00E411,&00F1A1
DATA &010000,&010F38,&011F59,&01306F
DATA &01428A,&0155B8,&016A09,&017F91
DATA &01965E,&01AE89,&01C823,&01E343
DATA &020000,&021E71,&023EB3,&0260DE
DATA &028514,&02AB70,&02D412,&02FF22
DATA &032CBC,&035D12,&039046,&03C686
DATA &040000,&043CE2,&047D66,&04C1BC
DATA &050A28