rhythmFunctions | R Documentation |
These functions are used to extract and translate between different representations of rhythmic (time duration) information.
x |
An input vector. The Must be parsable as rhythm infromation. |
... |
Arguments passed to the rhythm parser. There are also two hidden (advanced) arguments you can specify: |
scale |
A Defaults to Must be |
Exclusive , parseArgs |
An vector of exclusive interpretations and/or an optional list of arguments passed to the rhythm parser. Default to
|
inPlace |
Should non-rhythm information be retained in the output string? Defaults to Must be a singleton Defaults to A singleton See "Grace notes" section below. |
The full list of rhythm functions is:
Metric rhythm representations
Symbolic rhythm representations
recip()
(reciprocal note values)
notehead()
(traditional note-value symbols)
Numeric rhythm representations
duration()
(Whole notes)
quarters()
(quarter notes/crotchets)
Ametric rhythm representations
Symbolic rhythm representations
dur()
(durations of time)
Numeric rhythm representations
seconds()
ms()
(milliseconds)
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
) |>
Parsing (done by rhythmInterval()
) |>
Intermediate (rational) representation |>
Deparsing |>
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
.
**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).
To better understand how these functions work, read about how rhythms are parsed and deparsed.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.