Csbeats

Csbeats is an alternative score language that is aimed at specifying simple scores in standard western tunings and rhythms. Csbeats can be invoked via the CsScore component of a standard .csd score with bin="csbeats" or as stand-alone program which generates a standard numeric score.

As a stand-alone the program reads standard input and writes to standard output.

The csbeats language is very simple, having only 5 kinds of statement, and only one of them has any complexity. In general the introductory word for each statement type is case insensitive, so "QUIT", "quit", "QuIt"... are all the same. Comments can be introduced in either ANSI C89 format or C++ (that is either /* ... */ or // to the end of line) or Csound's semicolo.

  • QUIT

    Causes csbeats to exit. For flexibility the command END is also accepted for the identical action.

  • BEATS=integer

    Sets the number of beats per minute for the following score until the end or until it is reset. The default value is 60bpm. The token BPS is also acceptable instead of BEATS.

  • PERMEASURE=integer

    Sets the number of beats in a bar. The default value is 4.

  • BAR

    Start a new bar.

  • BAR integer

    Start the bar whose number is given.

  • i integer attributes

    Specified a note event for the numbered instrument. The attributes may be any of a pitch, duration or dynamic, or a positioning of the note to a beat or measure, and can be in any order.

    Pitches are specified with a conventional note name (English form) in upper case optionally followed by a #, x (for double sharp), b (for flat) or bb (for double flat). A note of Z is a rest (think zzzz). All notes except rests must be followed by an octave number, with A4 being international A (440Hz). Pitches are passed to Csound in Hertz in the parameter p4, and are twelve tone equal temprament.

    Durations are coded in lower case with the initial letter of the name.

    • ed Dotted eighth note (three quarters of a beat)
    • et Triplet eighth note (third of a beat)
    • e Eighth note (half a beat)
    • hd Dotted half note (three beats)
    • ht Triplet half note (one and a third beats)
    • h Half note (two beats)
    • qd Dotted quarter note (one and a half beats)
    • qt Triplet quarter note (two thirds of a beat)
    • q Quarter note (one beat)
    • sd Dotted sixteenth note (Three eighths of a beat)
    • st Triplet sixteenth note (sixth of a beat)
    • s Sixteenth note (quarter of a beat)
    • th Thirty-second note (an eighth of a beat)
    • w Whole note (four beats)

    Durations can be added together by giving more that one duration. To make this more intuitive a + sign can be used instead of white space.

    The dynamics are written in conventional notation, that is fff, ff, f, mf, mp, p, pp, ppp. These are passed to the instrument as p5 as 0 for fff, and one less dB for each step below. The default dynamic is fortissimo.

    If any of these attributes is missing it carried forward from the previous note, with beat position being incremented to the end of the previous note.

    In addition an event can be directed to a particular measure with an m attribute or a particular beat with a b.