Basic MIDI Input/Output Programming

MIDI in Windows

1. compkey   This C example program demonstrates how to read a key press from the computer keyboard. The program waits for keypresses from the computer keyboard and then displays which key was pressed untill the key 'q' is pressed which quits the program. [ Source CodeExecutable Program ]

2. keymidi   This C example program shows how to open MIDI output, send a MIDI message, and close MIDI output. When you press a key on the computer keyboard, a MIDI note will be either turned on or off. The program waits for keypresses from the computer keyboard and then displays which key was pressed untill the key 'q' is pressed which quits the program. [ Source CodeExecutable Program ]

Windows Multimedia Functions used in this program:

    midiOutOpen function which intializes MIDI output communication with the specified output port.
    midiOutShortMsg function for sending MIDI output messages (except for system exclusive messages).
    midiOutReset function which turns off all currently playing notes on a MIDI port.
    midiOutClose function which closes a MIDI output port.


2. keymidi2   This C++ example program does the same thing as the keymidi example above, but instead uses the MidiIO C++ library to interface with MIDI. [ Source CodeExecutable Program ]

3. keymidi3   This C++ example program does the same thing as the keymidi and keymidi2 examples above, but instead uses the Improv C++ library to interface with MIDI. The improv interface is a minature operating system for MIDI I/O programs. Notice that there is no main function in this example. This program uses the synthImprov environment which is described here. [ Source CodeExecutable Program ]

MIDI in Linux

See this webpage for simple MIDI programming examples for Linux using the Open Sound System (OSS).

Improv program examples

Improv is a full set of C++ classes and example programs for interactive MIDI programming in Windows and Linux. The synthImprov examples are designed for interaction between the computer and a performer playing on a MIDI synthesizer. The Radio Baton uses the batonImprov environment.








-- Craig Stuart Sapp