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.

Compiler

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.

Examples

For another example, see the hello world program.