Create a noteworthy string of a sequence of consecutive pitches.
pitch_seq(x, y, key = NULL, scale = NULL, format = c("space", "vector"))
character, valid pitch notation, e.g., "a2"
or "a,"
.
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.
character, key signature for a diatonic sequence.
key = NULL
(default) results in a chromatic sequence.
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
.
character, the timestep delimiter format, "space"
or
"vector"
.
noteworthy
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.
# chromatic sequence (default)
pitch_seq("a,", 13)
#> <Noteworthy string>
#> Format: space-delimited time
#> Values: a, b_, b, c d_ d e_ e f g_ g a_ a
pitch_seq("c5", -2)
#> <Noteworthy string>
#> Format: space-delimited time
#> Values: c5 b4
pitch_seq("c", "b")
#> <Noteworthy string>
#> Format: space-delimited time
#> Values: c d_ d e_ e f g_ g a_ a b_ b
# diatonic sequence
pitch_seq("c", 8, key = "c")
#> <Noteworthy string>
#> Format: space-delimited time
#> Values: c d e f g a b c'
pitch_seq("c", 8, "am")
#> <Noteworthy string>
#> Format: space-delimited time
#> Values: c d e f g a b c'
pitch_seq("c#,", "a#'", "am")
#> <Noteworthy string>
#> Format: space-delimited time
#> Values: d, e, f, g, a, b, c d e f g a b c' d' e' f' g' a'
# combine with alternative scale
pitch_seq("a", 8, "am", "harmonic minor")
#> <Noteworthy string>
#> Format: space-delimited time
#> Values: a b c' d' e' f' g#' a'