intervals | R Documentation |
Helper functions for musical intervals defined by two notes.
pitch_interval(notes1, notes2, use_root = TRUE)
pitch_diff(notes, use_root = TRUE, n = 1, trim = FALSE)
scale_interval(
notes1,
notes2,
use_root = TRUE,
format = c("mmp_abb", "mmp", "ad_abb", "ad")
)
scale_diff(
notes,
use_root = TRUE,
n = 1,
trim = FALSE,
format = c("mmp_abb", "mmp", "ad_abb", "ad")
)
tuning_intervals(tuning = "standard")
use_root |
logical, use lowest pitch in chord for pitch intervals or
scale intervals between adjacent timesteps. Otherwise intervals involving
chords are |
notes , notes1 , notes2 |
character, a noteworthy string. |
n |
integer, size of lag. |
trim |
logical, trim the |
format |
character, format of the scale notation: major/minor/perfect, augmented/diminished, and respective abbreviations. See argument options in defaults. |
tuning |
character, string tuning. |
Numeric intervals are directional. pitch_interval()
returns the signed
number of semitones defining the distance between two notes.
Named scale intervals are names only. Use pitch for direction.
scale_interval()
returns a character string that provides the named main
interval, simple or compound, defined by the two notes. This function
returns NA
for any uncommon out of range large interval not listed as a
named interval in mainIntervals()
.
pitch_interval()
and scale_interval()
compute intervals element-wise
between two noteworthy strings. pitch_diff()
and scale_diff()
work
similarly but compute lagged intervals on the elements in notes
.
a musical interval, integer or character depending on the function.
mainIntervals()
pitch_interval("b", "c4")
pitch_interval("c, e_, g_, a,", "e_, g_, a, c")
pitch_interval("c r", "dfa d")
pitch_interval("c r", "dfa d", use_root = FALSE)
scale_interval("c", "e_")
scale_interval("ceg", "egd'")
x <- "a, b, c d e f g# ac'e' a c' e'"
pitch_diff(x)
pitch_diff(x, use_root = FALSE)
scale_diff(x)
scale_diff(x, n = 2, trim = TRUE, use_root = FALSE)
# Lagged intervals respect rest timesteps.
# All timestep position including rests are retained.
# But the lag-n difference skips rest entries.
x <- "a, c r r r r g"
pitch_diff(x)
scale_diff(x)
pitch_diff(x, n = 2)
scale_diff(x, n = 2)
pitch_diff(x, n = 2, trim = TRUE)
scale_diff(x, n = 2, trim = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.