Coding the basics of the MIDI protocole was not very complicated, except concerning the fact that some 32 bits data are encoded using the Variable-Length Quantity code to use only the minimum number of bytes. It’s because MIDI (Musical Instrument Digital Interface) was launched in 1983 and its speed is only 31250 baud!
Two interesting articles about an early experiment: “Push Button Bertha” (1956). In the second link, there is some newspapers articles published in 1956-57:
Probably not yet in Fortran, our baby was just being born…
src/music.f90: a module containing some music theory elements (scales, circle of fifths, chords), and the subroutine write_chord() and the function get_note_name().
src/MIDI_control_changes.f90: a module with all the MIDI Control Changes parameters.
src/GM_instruments.f90: contains the list of 128 General MIDI instruments and 47 percussive instruments (channel 9).
src/demos.f90: a new demo4 plays a random walk on the circle of fifths. You can listen to it here . It’s a pleasant music, although just a random walk: the probabilities are 1/3 to move one chord clockwise on the circle of fifths, 1/3 to move one chord counterclockwise, 1/3 to switch between the major and minor circles. The Pythagoreans already knew the fifth was very important in music, with its simple 2/3 string length ratio!
The music theory elements are stored in arrays, for example chords can be defined like this and passed to the write_chord() subroutine: