Skip to contents

These functions are used to extract and translate between different representations of rhythmic (time duration) information.

Arguments

x

An input vector.

The x argument can be any (atomic) vector, or a rational (rhythmInterval), or NULL.

Must be parsable as rhythm infromation.

...

Arguments passed to the rhythm parser.

There are also two hidden (advanced) arguments you can specify: memoize and deparse (see the details below).

scale

A numeric or rational value which is used as the output unit of measurement.

Defaults to rational(1, 1).

Must be numeric or rational.

Exclusive, parseArgs

An vector of exclusive interpretations and/or an optional list of arguments passed to the rhythm parser.

Default to NULL and an empty list() respectively.

Exclusive must be NULL, or a character vector of either length 1 or length(x); parseArgs must be a list of named arguments to the rhythm parser.

inPlace

Should non-rhythm information be retained in the output string?

Defaults to FALSE.

Must be a singleton logical value: an on/off switch.

Defaults to FALSE.

A singleton logical value, or NA.

See "Grace notes" section below.

Details

The full list of rhythm functions is:

  • Metric rhythm representations

    • Symbolic rhythm representations

    • Numeric rhythm representations

  • Ametric rhythm representations

    • Symbolic rhythm representations

      • dur() (durations of time)

    • Numeric rhythm representations

These rhythm functions all work in similar ways, with similar arguments and functionality. Each function takes an input rhythm (time duration) representation (which can be anything) and outputs its own rhythm representation. For example, recip() takes any input representation and outputs **recip (reciprocal durations) data. Underneath the hood, the full processing of each function looks like this:

  • Input representation (e.g., **recip or **dur) |>

  • Output representation (e.g. **recip or **duration)

To read the details of the parsing step, read this. To read the details of the "deparsing" step, read this. To read more details about each specific function, click on the links in the list above, or type ?func in the R command line: for example, ?notehead.

Grace notes

**recip and **kern data sometime include tokens indicating grace notes---a special category of duration, usually used to indicate "freely" a-metric notes in an otherwise metric context. In humdrum data, grace notes are marked with "q" or "Q"; q should be reserved for tokens with no (other) duration information, while Q should be marked along with duration information: for example, aa-q or 16aa-Q. In practice, this distinction is not always made, and is rarely important.

By default, the **recip parser treats input marked as grace notes as having a duration of zero. However, if you pass a grace argument to the rhythm parser, you can control this behavior. If parse(grace = TRUE), grace-note durations (like the 16 in "16aa-Q") are parsed like any other duration. If grace = NA, grace-notes return as NA. If grace = FALSE, the duration returns as zero (the default behavior).

See also

To better understand how these functions work, read about how rhythms are parsed and deparsed.