Syntax Reference

Complete syntax specification for the Notations DSL

Basic Elements

Literals (Notes and Syllables)

Literals are text tokens without spaces. Any text can be used as a literal:

S R G M P D N sa ri ga ma pa dha ni do re mi fa so la ti

The notation system doesn't assign meaning to literals - only durations and layout matter.

Octaves

Dots indicate octaves. Place dots before a note for lower octaves, after for higher octaves (no spaces):

Syntax Octave
...SThree octaves below
..STwo octaves below
.SOne octave below
SMiddle octave (default)
S.One octave above
S..Two octaves above
S...Three octaves above
..S .S S S. S..

Whitespace

Spaces and line breaks between notes are ignored by the parser. They don't affect timing or layout:

S R G M S R G M

Both lines produce identical output.

Spaces (Karvais)

Spaces represent empty durations where the previous note continues. Use commas:

Symbol Name Duration
,Space (Karvai)1 unit
;Double space2 units
_Silent space1 unit (not displayed)
S , R ; G , , M

Silent spaces consume duration without displaying the space symbol, useful to avoid clutter.

Rests

Use hyphen for an explicit rest (no note continuation):

S - R - - G

Groups

Square brackets group multiple notes into a single beat:

S [R G] M [P D N] S.

Groups can be nested:

S [R [G M] P] D

Note Durations

Prefix a note with a number or fraction to set its duration:

\beatDuration(4) S 2 R G 3 M

Fractional durations are also supported:

\beatDuration(4) S 3/2 R G 1/2 M

Roles

Roles represent different types of content. Use a role selector with a colon (no space before colon):

Sw: S R G M P D N S. Sh: sa ri ga ma pa dha ni sa

Common roles:

  • Sw - Swaras (notes)
  • Sh - Sahitya (lyrics)

Create custom roles with the \role command.

Commands

Commands start with a backslash and control notation behavior:

\commandName(param1, param2, key=value)

See the Commands Reference for details.

Embellishments

Embellishments start with a tilde and continue until whitespace:

S ~kampita R G ~jaru M

See the Embellishments Reference for details.

Comments

Use // for line comments:

// This is a comment
S R G M
// Comments are ignored by the parser
P D N S.

Block comments are also supported:

/* This is a
   multi-line comment */
S R G M

Grammar Summary

notation      := elements
elements      := (command | roleSelector | atoms)*
command       := "\\" name "(" params? ")"
roleSelector  := name ":"
atoms         := atom+
atom          := duration? leaf marker?
leaf          := literal | group | space | rest
literal       := (dots? ident dots?) embellishment?
group         := "[" atoms "]"
space         := "," | ";" | "_"
rest          := "-"
duration      := number | fraction
fraction      := number "/" number
octave        := "."+ (before or after literal)
embellishment := "~" text
marker        := "<<" text ">>" | ">>" text "<<"

See Also