Package

purescript-abc-parser

Repository
newlandsvalley/purescript-abc-parser
License
MIT
Uploaded by
newlandsvalley
Published on
2020-11-26

Latest release Build Status

This is a parser for Chris Walshaw's ABC Notation which is primarily designed as an interchange format for scores of traditional music. Also included are functions to manipulate the parse tree in order to provide alteration of tempo, transposition, conversion to MIDI etc.

Features

  • The parser is primarily aimed at web applications that deal with single voice traditional music.
  • It is biased towards editor applications in that it attempts to be as lenient as possible whilst still honouring the intentions of the ABC specification. In particular, there is no requirement for any header to be present at all - sensible defaults are used instead. This means that an editor application can allow the user (if she prefers) to concentrate on the notes and only add the headers at a later stage.
  • It attempts to be helpful to score-engraving software. For example, bars are first class entities in the ABC ADT; grace notes are directly attached to the notes that they 'grace'; line continuations do actually join the two lines in question.
  • It attempts to be helpful to player applications in that it provides a translation to MIDI.
  • There is limited support for polyphony. The parser recognizes 'V' voice headers which may introduce each polyphonic voice. The Voices module allows the tune body to be partitioned into separate bodies for each voice if a score line is introduced by a Voice inline field (See section 7.3 of the ABC specification). However, the MIDI module ignores these Voice headers and thus does not support polyphony

Issues

  • Slurs (represented by round brackets) are awkward. They seem to be impossible to match - for instance they can span across bars or even across separate lines of music. I attach them directly to the notes that delineate the slur. However, where the slur is not directly attached to the note (e.g. when attached to a broken rhythm operator or tuplet operator) then the parser is lenient, accepting but discarding the slur bracket. Where a note is prefaced both by grace note(s) and an opening slur then the grace note must come before the slur bracket.
  • Decorations must be attached either to individual notes or to the 'y' typesetting space - they cannot be free-standing. This means that decorations may not be attached to note groups such as a chords or tuplets. This seems to be indicated by order of constructs (4.20).
  • I have found no description of how a tuplet should be validated. Currently, tuplets must be completely contained within a bar and the number of items in the tuplet must agree with the its signature. Spaces are allowed between the notes but tuplets may not be embedded, one inside the other.
  • Grace notes and decorations are not supported against chords. (I am unclear what the specification defines here with respect to grace notes and see note above.)
  • Grace notes are, however, supported against notes in all other contexts and attached to them directly, although optionally mediated by a left slur bracket.
  • In translating to MIDI, only a single voice is recognized and if voltas are present only the first and second are recognized (third and fourth are ignored).