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
/
SETCONVT.GFA
(
.txt
)
< prev
next >
Wrap
GFA-BASIC Atari
|
1985-11-20
|
4KB
|
124 lines
'
' Quartet Voiceset to Mr music seperate sample convertor!
' by Griff (C) November 1990
'
CLS
PRINT AT(23,2);"-----------------------------------------"
PRINT AT(23,3);"Quartet .SET to Mr Music .EIT Convertor!!"
PRINT AT(23,5);" Written in GFA Basic V3.02!"
PRINT AT(23,6);" By Martin Griffiths"
PRINT AT(23,7);"-----------------------------------------"
PRINT AT(25,22);"- Please Press any key to Continue -"
i&=INP(2)
DIM voiceset_buf%(45000) !200k voiceset buffer
DIM loop_flag&(19),voice_length&(19),loop_offy&(19),voice_addr%(19),voice_name$(19)
empty_buf$=STRING$(1402,128)
fillr_buf$=STRING$(1402,128)
voice$=STRING$(32500,0)
voiceset_ptr%=V:voiceset_buf%(0)
CLS
PRINT AT(19,1);"Please Select a Quartet .SET file to Convert"
PRINT AT(19,2);"--------------------------------------------"
FILESELECT "\*.SET",voiceset_name$,voiceset_name$
IF voiceset_name$=""
END
ENDIF
BLOAD voiceset_name$,voiceset_ptr%
voice_freq&=PEEK(voiceset_ptr%)
no_voices&=PEEK(voiceset_ptr%+1)-1
j%=voiceset_ptr%+3
FOR i&=0 TO no_voices&-1
voice_name$(i&)=""
FOR j&=0 TO 3
voice_name$(i&)=voice_name$(i&)+CHR$(PEEK(j%))
INC j%
NEXT j&
ADD j%,3
i%=voiceset_ptr%+LPEEK(voiceset_ptr%+&H8E+SHL(i&,2))
voice_addr%(i&)=i%+8
voice_length&(i&)=DPEEK(i%+4)
IF DPEEK(i%)=65535
loop_flag&(i&)=FALSE
loop_offy&(i&)=0
ELSE
loop_flag&(i&)=TRUE
loop_offy&(i&)=voice_length&(i&)-DPEEK(i%)
ENDIF
NEXT i&
CLS
PRINT AT(27,1);"Quartet Voiceset Statistics";
PRINT AT(27,2);"---------------------------";
PRINT AT(46,7);"Voiceset Filename : ";voiceset_name$;
PRINT AT(46,8);"Voiceset length : ";voiceset_length%;
PRINT AT(46,9);"Voiceset frequency: ";voice_freq&;"Khz";
PRINT AT(46,10);"No. of instruments: ";no_voices&;
PRINT AT(1,4);"Sample Name Sample length Loop offset"
PRINT AT(1,5);"----------- ------------- -----------"
FOR i&=0 TO no_voices&-1
j&=6+i&
PRINT AT(4,j&);voice_name$(i&);
PRINT AT(20,j&);voice_length&(i&);
IF loop_flag&(i&)=TRUE
PRINT AT(36,j&);loop_offy&(i&);
ELSE
PRINT AT(35,j&);"No loop";
ENDIF
NEXT i&
PRINT AT(24,25);"- Press any key to continue -";
i&=INP(2)
CLS
PRINT " Select Name for .EIT Voiceset "
PRINT " -----------------------------"
FILESELECT "\*.EIT",vname$,vname$
IF vname$=""
END
ENDIF
PRINT "Please note the Samples will be converted to 11khz!"
PRINT
i&=INP(2)
handle&=GEMDOS(&H3C,L:V:vname$,0) !f_create
CLR cum%
frac#=11/voice_freq&
FOR i&=0 TO no_voices&-1
voice_length&(i&)=voice_length&(i&)*frac#
loop_offy&(i&)=loop_offy&(i&)*frac#
VOID GEMDOS(&H40,handle&,L:4,L:V:cum%)
VOID GEMDOS(&H40,handle&,L:2,L:V:voice_length&(i&))
VOID GEMDOS(&H40,handle&,L:2,L:V:loop_offy&(i&))
cum%=cum%+voice_length&(i&)+1400
NEXT i&
i&=-1
VOID GEMDOS(&H40,handle&,L:2,L:V:i&)
frac#=voice_freq&/11
FOR i&=0 TO no_voices&-1
length%=voice_length&(i&)
IF loop_flag&(i&)=TRUE
offset%=loop_offy&(i&)
ELSE
CLR offset%
ENDIF
' Convert frequency
j%=voice_addr%(i&)
CLR dest#
FOR j&=0 TO length%-1
POKE V:voice$+j&,PEEK(j%+dest#)
ADD dest#,frac#
NEXT j&
PRINT "Adding:";voice_name$(i&)
VOID GEMDOS(&H40,handle&,L:length%,L:V:voice$) !f_write
IF offset%=0
VOID GEMDOS(&H40,handle&,L:1400,L:V:empty_buf$) !tag 1400 "-128" bytes
ELSE
j%=V:voice$+offset%
factor&=length%-offset%
FOR j&=0 TO 1399
POKE V:fillr_buf$+j&,PEEK(j%+(j& MOD factor&))
NEXT j&
VOID GEMDOS(&H40,handle&,L:1400,L:V:fillr_buf$) !f_write
ENDIF
NEXT i&
VOID GEMDOS(&H3E,handle&) !f_close
PRINT AT(26,25);"- Press any key to Restart -";
i&=INP(2)
RUN