The old Midi Kit (libmidi.so)

The old Midi Kit, or midi1 for short, goes all the way back to DR8, when the BeOS only ran on BeBoxen. Fortunately for us, it is pretty well documented:

  • Midi Kit chapter in the online Be Book
  • Midi Kit section of the old Be Developer Library
  • Be Newsletter Volume 1, Issue 49 - Introduces the MIDI synth
  • Be Newsletter Volume 1, Issue 52 - Follow-up on issue 49
  • Be Newsletter Volume 1, Issue 91 - How to use BSynth
  • Be Newsletter Volume 1, Issue 102 - Axe sample code
  • Be Newsletter Volume 1, Issue 104 - How to use BMidiPort
  • Be Newsletter Volume 2, Issue 23 - EdMidi sample code
  • Be Newsletter Volume 2, Issue 37 - How to use the MIDI synth
  • Be Newsletter Volume 3, Issue 37 - Whistle sample code

To summarize, there are four basic MIDI classes:

  • BMidi is the base class for most other classes from the Midi Kit
  • BMidiPort can talk to a MIDI hardware port
  • BMidiStore can read, write, and perform Standard MIDI files
  • BMidiText is a debugging aid that dumps MIDI messages to stdout

The following classes let you use the Midi Kit's General MIDI synthesizer:

  • BSynth controls the synthesizer
  • BMidiSynth connects a BMidi object to the synth
  • BMidiSynthFile connects a MIDI file to the synth
  • BSamples lets you access the synth's sound data stream

To make MIDI data stream through your application, you create a "network" of BMidi-derived objects that send and receive MIDI messages.

The old Midi Kit is slowly fading into obscurity. You may want to use the new kit instead. Also note that the Haiku implementation of the kit sometimes behaves differently than the one from BeOS R5 or what the BeBook says, but usually for the better.

Especially the synth classes are not completely functional, but enough to play back General MIDI tunes. They should be backwards compatible with the majority of BeOS MIDI applications. Not all methods of BSynth, BMidiSynth, and BMidiSynthFile are implemented because some of them are rather obscure. BSamples is a complete no-op; in other words, with the Haiku Midi Kit you cannot push waveform data into the output stream of the softsynth.