Quarter notes push
A note pushes its row value. Notes aligned in one column form a chord and push their sum.
Unicode esoteric language
Music you can execute. Notes become values, phrasing becomes control flow, and a ten-row staff becomes a stack machine.
Pitch becomes state
Staffcode reads source from left to right across one or more systems. Vertical position supplies a value; notation decides what happens to it.
A note pushes its row value. Notes aligned in one column form a chord and push their sum.
Ten selectors cover arithmetic, stack manipulation, character output and integer output.
Comparisons, logical not, integer input and character input share the same pitch system.
Score explorer
Each selection below is a valid program from the reference repository.
This page bundles Noto Music for complete musical glyph coverage. The explorer keeps every logical source cell at a fixed width. Font license.
The staff is visually aligned for reading. Use Copy score for the exact UTF-8 source.
Advanced example
The complete song is generated by a single 99-pass repeat. The current count stays on the stack while conditionals select singular, plural and no more; the final verse executes after the loop.
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.
ยทยทยท
1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
Beyond arithmetic
Reference implementation
The repository includes the interpreter, thirteen examples, a complete language specification and more than one hundred generated conformance programs.