Custom Rhythm Patterns: Text Language
Custom Rhythm Patterns: Text Language

Custom Rhythm Patterns: Text Language

Text-based music notation editors have been around for a long time. Leland Smith’s SCORE program involved multiple passes to create complex musical notation; LilyPond uses a single pass to generate musical scores; and ABC notation is a simpler format designed for notating single melodies. Rhythm Lab also has a relatively simple text input format for defining a rhythm pattern.

The Symbols

Rhythm Lab patterns are defined by a series of text characters.

  • Note Values, from 128th notes to double whole notes, are indicated by the following characters: o, x, t, s, e, q, h, w, ww.
  • Dots are indicated by adding one to three ‘d’ characters at the end of a note value character. 128th notes cannot be dotted; 64th notes can only be dotted once; 32nd notes can only be dotted twice; 16th notes and larger can be dotted up to three times. Examples: ‘sdd’ = double-dotted sixteenth; ‘qddd’ = triple-dotted quarter note.
  • Rests are indicated by ‘r’ at the end of a value. Examples: ‘qr’ = quarter rest; ‘mr’ = measure rest; ‘hdr’ = dotted half rest.
  • Ties are indicated by a ‘t’ at the end of the first tied note. Examples: ‘qt e’ = quarter note tied to an 8th note; ‘qt et s’ = quarter tied to an 8th tied to a 16th note.
  • Beamed groups are enclosed in curly braces. Examples: { e e e e } = four 8th notes beamed together; { e s s } = 8th and two 16ths beamed together.
  • Tuplet groups are enclosed in square brackets. The initial term in a tuplet group is a”key” that indicates the actual notes / normal notes : normal note value. Examples: ‘ [ 3/2:e { e e e } ]’ = a group of three triplet 8th notes, beamed; ‘ [ 5/4:s { s s e s } ]’ = a group of 16th and 8th notes (beamed) in a quintuplet; ‘ [ 3/2:q q q q ] = a group of triplet quarter notes, unbeamed; ‘ [ 3/2:e { e [ 3/2:s s s s ] } ] ‘ = a beamed triplet 8th note group with a nested 16th-note triplet group.
  • Hidden groups are treated like any other notes, but enclosed within the ‘hi’ (hide) and ‘uh’ (unhide) terms. Examples: ‘ hi q q h uh ‘ = two hidden quarters followed by a hidden half note.
  • Barlines are indicated by ‘bs’ (single barline) and ‘bf’ (final barline).
  • Time signatures are preceded by a ‘$’ and then indicate numerator and denominator. Time signatures, when present, must appear at the very beginning of a measure. Examples: ‘ $3/4 q q q bs ‘ = a measure with a 3/4 time signature and containing three quarter notes; ‘ $2+3/8 { e e } q e bs ‘ = a measure with a 2+3/8 time signature containing a beamed group of two 8th notes followed by a quarter note and 8th note.
  • Special characters for drum patterns include drumline patterns which need to distinguish between left and right hand notes in the same line. This is accomplished by preceding note values with either ‘r’ for right or ‘l’ for left. Examples ‘ r q { e e } l q { e e } ‘ = a quarter + two 8th for the right hand followed by a the same pattern for the left hand. Drumkit patterns need to indicate hi-hat notes that use the special ‘x’ notehead, so note values for h-hat patterns (other than rests) append ‘x’ to each note value. Example: ‘ { sx sx sx sx } ‘ = four beamed 16th notes for the hi-hat.

The Complete Code

Rhythm pattern strings are contained inside the “exercises” objects, and are listed within the “voices” element, labeled with the key “pattern.”

"exercises" : [
      "category" : "custom",
      "timeSig" : "2\/4",
      "sequence" : 0,
      "points" : 0,
      "measureCount" : 4,
      "title" : "Level 1A 3",
      "bpm" : 127,
      "voices" : [
          "type" : "v1pattern",
          "pattern" : " q  qr bs  h bs  q  q bs  h bf",
          "sequence" : 0
      "type" : "single"

See the article “ Edit Custom Patterns in a Text Editor” for a more complete example.