We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Rhapsody
Jump to navigation
Jump to search
Rhapsody is a programming language designed by PSTF, inspired by Fugue.
The Core Mechanism
- The program is a sequence of pitches (MIDI note numbers or note names, e.g., C4, D#5).
- The first pitch acts as the anchor (it sets the tonal center but generates no instruction).
- Every subsequent pitch generates exactly one command.
- The command is determined by
delta = (current_pitch - previous_pitch) mod 13. We use modulo 13 because we have exactly 13 commands, and it beautifully wraps octaves. A jump up a minor 2nd gives +1; a jump down a minor 2nd gives -1 mod 13 = 12—so direction matters intrinsically.
Instruction Set
Lower m stands for minor, upper M stands for major, A stands for augmented, d stands for diminished, P stands for perfect.
- Unison
- Move right.
- Semitone up
- Move left.
- Whole tone up
- Increment.
- m3 up
- Decrement.
- M3 up
- Output character.
- P4 up
- Input character.
- A4/d5 up
- Loop start.
- P5 up
- Loop end.
- m6 up
- Input integer.
- M6 up
- Output integer.
- m7 up
- Random number between 0 to 255.
- M7 up
- Once-jump.
- Octave up
- End of jump.
Example Programs
-
Cat Program
-
Truth Machine
-
Hello, World!
Interesting Things
If we convert Bach's BWV 846 into the raw command, then we'll get this:
.-,.-,.-.-,.-,.-+],-,,-.+ --snip--
Obviously because of the perfect 5th in the program, it will output "Unmatched bracket".