Fugue is an esoteric programming language created by Nikita Ayzikovsky in 2005. It shares semantics with its sister language, Prelude, but uses music as source code. Each "voice" in Prelude is indeed a separate voice in Fugue. Simultaneous instructions in Prelude correspond to notes in different voices sounding simultaneously; other than that, note durations don't matter.
The first note played by each voice doesn't matter. The intervals between a note and the next one (in the same voice) correspond to Prelude instructions, in the following fashion:
- # - Unison
- ^ - ascending second
- v - descending second
- + - ascending fourth or tritone
- - - descending fourth or tritone
- ( - ascending fifth
- ) - descending fifth
- ! - ascending sixth
- ? - descending sixth
Third, ascending or descending, is a "push number" instruction: the next interval is interpreted as a number to be pushed. 5 semitones up pushes 5, and 10 semitones down pushes -10. This allows for a greater range of numbers to be pushed than in Prelude, which only allows 0..9.
Intervals greater than a sixth are ignored and may be used freely.
There is a compiler for Fugue that generates 80x86 code from a MIDI file. It can also "disassemble" the MIDI file to human-readable format. The compiler's source can be found on The Esoteric File Archive.
Note that due to a bug in the compiler, a voice with more instructions than the following voice (counting pushing a number as a single instruction) can have its excess instructions cut off in certain circumstances. Therefore, the voices should always increase in instruction count, either by rearranging them or by appending no-ops as necessary.
For another example, see the hello world program.