pitch_seq: Create a sequence from pitch notation

View source: R/pitch.R

pitch_seqR Documentation

Create a sequence from pitch notation

Description

Create a noteworthy string of a sequence of consecutive pitches.

Usage

pitch_seq(x, y, key = NULL, scale = NULL, format = c("space", "vector"))

Arguments

x

character, valid pitch notation, e.g., "a2" or "a,".

y

character, same as x for the sequence x:y. If a number, the length of the sequence from x and the sign of y determines the direction.

key

character, key signature for a diatonic sequence. key = NULL (default) results in a chromatic sequence.

scale

character, if you want to use a different scale in conjunction with the key/root note, you can provide it, e.g., scale = "harmonic minor". Ignored if key = NULL.

format

character, the timestep delimiter format, "space" or "vector".

Details

Note that all pitches resulting from the defined sequence must be in the semitone range 0-131 or an error is thrown.

If not using a chromatic sequence and x (or y if also a pitch) is not part of the key signature or scale, the sequence is internally bound. See examples.

Format of accidentals in the result is prioritized by the scale and key, the key when no scale is given, then x (and y if also a pitch), and finally defaults to flats if ambiguous.

Value

noteworthy

Examples

# chromatic sequence (default)
pitch_seq("a,", 13)
pitch_seq("c5", -2)
pitch_seq("c", "b")

# diatonic sequence
pitch_seq("c", 8, key = "c")
pitch_seq("c", 8, "am")
pitch_seq("c#,", "a#'", "am")

# combine with alternative scale
pitch_seq("a", 8, "am", "harmonic minor")

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