PARAFF is a sheet music domian-specific language, designed for algorithmic musical composition.
Paraff code:
BOM K0 TN4 TD4 S1 Cg c D1 EOM
Lilypond code:
\relative c' {
\key c \major \time 4/4 \clef "treble" c1
}
Sheet music:
-
Friendly for tokenizers
Paraff vocabulary made up by a group of pure alphabet-number words. A paraff sentence is a sequence of words, separated by space.
The total number of paraff tokens is less than 256. So music scores in paraff format can be serialized as a uint8 byte array.
-
Convertable from/to Lilypond
Lilypond is a strong expressive music language, whose engraving program with comprehensive functionaliy. Paraff is designed refering to Lilypond, whose context dependent grammars were simplified, and scope symbols were removed.
Paraff score can be losslessly converted into Lilypond. Most regular Lilypond scores can be converted into Paraff. However, there are some restriction in grammar usage for complex scores.
-
Parseable into JSON
Paraff is not only a music tokenization solution, as a language, it also has a grammar interpreter by JISON.
The Paraff grammar file is here. If you are familiar with BISON/JISON, you can test the grammar parsing by Jison debugger.
yarn ts ./tools/paraffToLilypond.ts paraff-source-file.yaml path-to-target-dir
yarn ts ./tools/paraffTokenizer.ts paraff-source-file.yaml
The Paraff document with more details is coming soon.