transpose: Transpose pitch

View source: R/transpose.R

transposeR Documentation

Transpose pitch

Description

Transpose pitch by a number of semitones.

Usage

transpose(notes, n = 0, octaves = NULL, accidentals = NULL, key = NULL)

tp(notes, n = 0, octaves = NULL, accidentals = NULL, key = NULL)

Arguments

notes

character, a noteworthy string.

n

integer, positive or negative number of semitones to transpose.

octaves

NULL or character, "tick" or "integer" octave numbering in result.

accidentals

NULL or character, represent accidentals, "flat" or "sharp".

key

NULL or character, use a key signature to specify and override accidentals. Ignored if c or am.

Details

This function transposes the pitch of notes in a noteworthy string.

Transposing is not currently supported on a phrase object. The notes in a phrase object have already been transformed to LilyPond syntax and mixed with other potentially complex information. Transposing is intended to be done on a string of notes prior to passing it to phrase(). It will work on strings that use either integer or tick mark octave numbering formats and flats or sharps, in any combination. The transposed result conforms according to the function arguments. When integer octaves are returned, all 3s are dropped since the third octave is implicit in LilyPond.

When octaves, accidentals and key are NULL, formatting is inferred from notes. When mixed formats are present, tick format is the default for octave numbering and flats are the default for accidentals.

Value

character

Examples

transpose("a_3 b_4 c5", 0)
tp("a_3 b_4 c5", -1)
tp("a_3 b_4 c5", 1)
tp("a#3 b4 c#5", 11)
tp("a#3 b4 c#5", 12)
tp("r s a#3 b4 c#5", 13)
tp("a b' c#''", 2, "integer", "flat")
tp("a, b ceg", 2, "tick", "sharp")

tabr documentation built on Sept. 12, 2024, 6:18 a.m.