"Q: How can you tell when a violin is out of tune?
A: The bow is moving."
YOUR SECOND GFA BASIC 3.XX MANUAL
- or -
HOW I LEARNED TO STOP WORRYING AND LOVE GFA-BASIC
CHAPTER TWELVE - MIDI
by Han Kempen
With the command INPMID$ the internal MIDI-buffer is read and at
the same time cleared:
dummy$=INPMID$ ! clear MIDI-buffer
You can find the buffer-address and the buffer-size with XBIOS
The default size of the MIDI-buffer is only 128 bytes, but you
can change the size of the buffer:
DIM buffer|(size%-1) ! new MIDI-buffer
LPOKE ptr%,VARPTR(buffer|(0)) ! start-address of new buffr
DPOKE ptr%+4,size% ! size
DPOKE ptr%+6,0 ! buffer-head
DPOKE ptr%+8,0 ! buffer-tail
DPOKE ptr%+10,0 ! low mark (not used)
DPOKE ptr%+12,size%-1 ! high mark (not used)
Because handshake is impossible with MIDI, you need a large
buffer (at least 16 K) if MIDI-bytes are coming in fast.
If you use INP(3) to read MIDI-bytes, you should first check
with INP?(3) if the MIDI-buffer contains data. If you use INP(3)
and no bytes are available, your ST will freeze. Until you reset
Midi_buffer_new & Midi_buffer_restore MIDI_BUF
Change the size of the Midi-buffer (default 128 bytes):
@midi_buffer_new(16384,old.buffer%) ! 16 K
@midi_buffer_restore(old.buffer%) ! restore def.buffer
A simple MIDI-monitor to examine the MIDI-bytes that are
received by your Atari ST:
Switch everything off on one MIDI-channel:
@midi_off(1) ! switch off on channel 1
Switch everything off on all channels (1-16):
Play music that has been recorded with Procedure Midi_record:
@midi_record(last.byte%,song|(),song.time%()) ! improvise
@midi_play(last.byte%,song|(),song.time%()) ! listen
Record music. Play it with Procedure Midi_play.
The following MIDI-command Procedures have self-evident names.
Please note that you have to use 1-16 for the MIDI-channels and
0-127 for other parameters (unless otherwise stated in a
The text of the articles is identical to the originals like they appeared in old ST NEWS issues. Please take into consideration that the author(s) was (were) a lot younger and less responsible back then. So bad jokes, bad English, youthful arrogance, insults, bravura, over-crediting and tastelessness should be taken with at least a grain of salt. Any contact and/or payment information, as well as deadlines/release dates of any kind should be regarded as outdated. Due to the fact that these pages are not actually contained in an Atari executable here, references to scroll texts, featured demo screens and hidden articles may also be irrelevant.