logajan@ns.network.com (John Logajan) (11/28/89)
Someone requested a midi recorder-playbacker.
Here is my entry -- in GFA Basic.
------
PRINT "Simple midi recorder/playback program." ! by John Logajan, Nov 27, 1989.
DIM bt%(10000),btt%(10000) ! 10,000 midi bytes and 10,000 byte times.
done=0
WHILE done=0
INPUT "Enter, r=record, p=play, s=save, l=load, q=quit ";c$
IF c$="r"
GOSUB record
ENDIF
IF c$="p"
GOSUB play
ENDIF
IF c$="s"
GOSUB keep
ENDIF
IF c$="l"
GOSUB revue
ENDIF
IF c$="q"
done=1
ENDIF
WEND
END
REM
REM
REM
PROCEDURE record ! Record yourself on the midi keyboard.
WHILE INP?(3) ! Throw away buffered junk.
x=INP(3)
WEND
PRINT "It would probably be a good idea to power off/on your midi instrument"
PRINT "at this time to insure that it sends a proper select channel function"
PRINT "(which it should do upon playing the first key.)"
PRINT
PRINT "Begin playing on your midi instrument."
PRINT "Press any key on the Atari keyboard to exit recording mode."
st%=TIMER ! Start time as a reference.
bc%=0 ! Zero byte (midi event) counter.
WHILE NOT INP?(2) ! Loop until Atari key pressed.
IF INP?(3) ! Test for midi incoming byte.
INC bc% ! Increment the event counter.
bt%(bc%)=INP(3) ! If incoming byte, save byte in byte array.
btt%(bc%)=TIMER-st% ! Also save relative time byte arrived.
ENDIF
WEND
x=INP(2) ! Throw away useless key pressed.
RETURN
REM
REM
REM
PROCEDURE play ! Play back your creations.
st%=TIMER-btt%(1) ! Get playback start time as a reference.
FOR j%=1 TO bc% ! Do each saved event -- when it is time --
WHILE btt%(j%)>TIMER-st% ! -- by delaying until it is time --
WEND
OUT 3,bt%(j%) ! -- and then sending event (byte) to the midi.
NEXT j%
RETURN
REM
REM
REM
PROCEDURE keep ! Save your magnum opus works.
fn$=""
WHILE LEN(fn$)=0 ! I won't allow zero length file names.
INPUT "Enter name of file to store this musical work of art in";fn$
WEND
PRINT "... saving file ..."
OPEN "O",#1,fn$
FOR j%=1 TO bc%
WRITE #1,bt%(j%),btt%(j%)
NEXT j%
CLOSE #1
PRINT "File saved."
RETURN
REM
REM
REM
PROCEDURE revue
fn$=""
WHILE LEN(fn$)=0
INPUT "Enter name of music file you wish to hear played";fn$
WEND
PRINT "... loading ..."
OPEN "I",#2,fn$
bc%=0
WHILE NOT EOF(#2)
INC bc%
INPUT #2,bt%(bc%),btt%(bc%)
WEND
CLOSE #2
PRINT "File loaded and ready to play."
RETURN
--
- John M. Logajan @ Network Systems; 7600 Boone Ave; Brooklyn Park, MN 55428 -
- logajan@ns.network.com, john@logajan.mn.org, Phn 612-424-4888, Fax 424-2853 -hafer@tubsibr.uucp (Udo Hafermann) (11/30/89)
logajan@ns.network.com (John Logajan) writes: >Someone requested a midi recorder-playbacker. I remember reading that EZ-track by Hybrid Arts has been turned public domain. Correct? If so: it's a reasonably complete GEM-based 20-track sequencer.