Skip to contents

These functions are used to extract and translate between different representations of pitch information. The functions can also do things like transposing and simplifying pitches.

Arguments

x

Input data to parse as pitch information.

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

...

Arguments passed to the pitch deparser.

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

generic

Should "specific" pitch information (accidentals and qualites) be discarded?

Defaults to FALSE.

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

simple

Should "compound" pitch information (octave/contour) be discarded?

Defaults to FALSE.

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

Key

The input Key used by the parser, deparser, and transposer.

Defaults to NULL.

Must be a diatonicSet or something coercable to diatonicSet; must be either length 1 or length(x)

parseArgs

An optional list of arguments passed to the pitch parser.

Defaults to an empty list().

Must be a list of named arguments to the pitch parser.

transposeArgs

An optional list of arguments passed to a special transpose() call.

Defaults to an empty list().

Must be a list of named arguments to transpose().

inPlace

Should non-pitch information be retained in the output string.

Defaults to FALSE.

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

This argument only has an effect if the input (the x argument) is character strings, and there is extra, non-pitch information in the input strings "besides" the pitch information. If so, and inPlace = TRUE, the output will be placed into an output string beside the original non-pitch information. If inPlace = FALSE, only the pitch output information will be returned (details below).

Value

NULL inputs (x argument) return a NULL output. Otherwise, returns a vector/matrix of the same length/dimension as x. NA values in the input x are propagated to the output.

Details

The full list of pitch functions is:

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

  • Input representation (e.g., **pitch or **semits) |>

  • Output representation (e.g. **kern or **solfa)

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, ?kern.

The "partial" pitch functions octave(), step(), accidental(), and quality() are so-called because they each only return one part/aspect of pitch information, and only that part. For example, accidental() only returns he accidentals (if any) of pitches.

See also

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