9 ways to NRT, part 0: NRT syntax

2014-12-19

Welcome to Part 0 of "9 ways to NRT"! This blog series is my way of finding interesting ways to utilize my NRT micro-notation language to do music-related things. It will also be my way of exploring how the Unix Philosophy can be applied to computer-generated music.

NRT is very small program written using Flex and Bison. By itself, it doesn't do a whole lot, but chained with other free utilities, it has the potential of doing a number of useful tasks for musicians and composers.

In 9 more similarly titled blog posts, I will demonstrate some of these tasks and utilities.

Use this blog post as a reference when using NRT

Syntax

NRT is about musical notation; a sequence of notes. A single note can be defined like so:

note = solfege + (accidental) + (octave) + (rhythm)

Any NRT note will follow this regular expression (not necessary to understand):

"^[drmfsltDRMFSLT][+-\=]?[,']*(?:[1-9][0-9]?[.]?)?$"

Where:

solfege is a solfege syllable. Instead of using notes, NRT uses a movable do system. Syllables are the first letters of the solfege alphabet [d]o [r]e [m]i [f]a [s]o [l]a [t]i. Capital letters of these notes will shift everything up by an octave.

accidental is an optional character for the note. The possible accidentals are flat [-] sharp[+].

octave is an optional character to change the octave up ['] or down [,]. These characters can be stacked. '' would be two octaves up, ',,,' would be 3 octaves down, etc...

rhythm is an optional number coresponding to rhythm. The available numbers are 1, 2, 4, 8, and 16, which correspond to whole notes, half notes, eigth notes, and sixteenth notes. a "." can be added after the rhythm to make these notes dotted. if no rhythm is specified, then it defaults to either a quarter note [4] or the last rhythm defined.

Examples

drm
quarter notes 'do re mi'

d2rm
half notes 'do re mi'

d2. r4m
dotted half note 'do', quarter note 're', quarter note 'mi'

dr-m-
quarter note 'do ra me'
d'Rm'
'do re mi' one octave up
d,r,m,
one octave down
dr+m
'do ri mi'