Skip to main content

 "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
                             PART 13
                      CHAPTER TWELVE - MIDI
                          by Han Kempen

INPMID$

 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
14 (Iorec):

     adr%=LPEEK(XBIOS(14,2))
     size%=DPEEK(adr%+4)

 The default size of the MIDI-buffer is only 128 bytes,  but  you
can change the size of the buffer:

     ptr%=XBIOS(14,2)
     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.

INP

 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
the computer.

                     Procedures (CHAPTER.12)

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

Midi_monitor                                            MIDI_MON
 A  simple  MIDI-monitor  to  examine  the  MIDI-bytes  that  are
received by your Atari ST:
     @midi_monitor

Midi_off                                                 MIDI_OFF
 Switch everything off on one MIDI-channel:
     @midi_off(1)        ! switch off on channel 1

Midi_off_all                                             MIDI_ALL
 Switch everything off on all channels (1-16):
     @midi_off_all

Midi_play                                                MIDIPLAY
 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

Midi_record                                              MIDIRCRD
 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
Procedure).
                                                       \MIDI_COM\
Midi_channel_pressure                                    CH_PRESS
Midi_control                                              CONTROL
Midi_data                                                    DATA
Midi_hold                                                    HOLD
Midi_key_pressure                                        KEY_PRES
Midi_modulation                                          MODULATN
Midi_note_off                                            NOTE_OFF
Midi_note_on                                              NOTE_ON
Midi_notes_off                                           NOTESOFF
Midi_omni                                                    OMNI
Midi_pitch_bend                                          PITCHBND
Midi_program                                              PROGRAM
Midi_volume                                                VOLUME
 

Disclaimer
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.