14. Saving
and loading MIDI code
14.1 MIDI
files
To
allow the production of MIDI files,
type cmd-option space or select "Settings" in the "Windows" menu. Then check
button "Write MIDI files". Whenever "Produce items" (cmd-r) or "Play
selection" (cmd-p) are invoked, you are now offered to save the item to a MIDI
file. The first time BP2 will prompt the creation of a MIDI file. Then it
will propose to create a new file or go on saving to the current one. These
are the default
file
saving options
which can be modified in a dialog displayed with "Settings" (cmd-option space),
see Fig.33.
Fig.33
Default file saving options
BP2
supports three
MIDI
file formats:
types 0, 1 and 2. Here are the tips for choosing an output format:
- If
the file will contain a single musical item, or a sequence of items produced by
a grammar in the "Improvize" mode, any format is OK. Keep in mind, however,
that format 2 may be rejected by single-track MIDI programs.
- In
the current version, BP2 saves each item to a single track. Types 0 and 1 may
therefore be considered equivalent.
- If
the file will contain several independent musical items (each of which might
have a different tempo or time signature), then type 2 must be used.
MIDI
files may also be imported by sound-object prototypes (see §2.3.1).
14.2 Storing
and sending MIDI data
"Receive
MIDI data to file",
in the "File" menu, makes it possible to store any in-coming stream of MIDI
messages to a text file. It may for instance be used to save the set-up of a
MIDI device using its bulk transfer facility. Time information is not saved,
but it is normally not required for system exclusive messages.
Conversely,
"Send MIDI data from file"
sends data from a text file back to a MIDI device. It may be used to initialise
the device.
On
old machines like my good old Mac II-ci, these procedures are too slow for
loading and sending streams larger than the buffer of the in-built MIDI driver
(30,000 bytes).
The
same features are found in most commercial MIDI programs. With the HyperMIDI
stack which was supplied with early version of BP2, the stack's buffer had to
be set to a size larger than that of the MIDI stream, e.g. 120,000 bytes for a
dump of Roland D-50.