sonority | R Documentation |
The sonority()
function accepts vectors of notes, usually
grouped into multiple chords by a groupby
argument, and interprets
those notes as a tertian sonority.
Chords are output using the representation indicated by the deparser
argument.
By default, with/within.humdrumR will automatically pass
sonority
the groupby
argument groupby = list(Piece, Record)
,
so chords are estimated for each record in the dataset.
sonority(
x,
deparser = chord,
Key = NULL,
inversions = TRUE,
incomplete = TRUE,
enharmonic = FALSE,
inPlace = length(groupby) > 0,
fill = TRUE,
groupby = list(),
...
)
x |
Input data, interpreted as pitches. This vector is interpreted as pitch information using |
deparser |
What output representation do you want? Defaults to Must be a chord function, like |
Key |
The input key used by the deparser. Defaults to Must be a Some chord parsers don't use |
inversions |
Should we interpret note sets as inversions? Defaults to Must be a singleton |
incomplete |
Should we return incomplete chords? Defaults to Must be a singleton |
enharmonic |
Should pitches be interpreted enharmonically? Defaults to Must be a singleton |
inPlace |
Should the output always match the input? Defaults to Must be a singleton |
fill |
Should the output duplicate each chord for every note in the input? Defaults to Must be a singleton This argument only has an effect if |
If inPlace = TRUE
, sonority()returns vectorized output, with the output matching the length of the input vector. By default,
fill = FALSE, and each output chord is repeated to align with the notes of the chord. If
fill = FALSE, each chord is returned only once, but padded with null tokens to match length of the input. Finally, if
inPlace = FALSEonly one chord is returned for each group in
groupby'.
If inversions = TRUE
, the notes are interpreted
in the chordal inversion that is most compact (triad like)
on the circle of thirds.
If inversions = FALSE
, the lowest note is always interpreted as
the root.
If incomplete = TRUE
, incomplete chords are returns as they are,
so you might see things like "C7no5" (seventh chord with no fifth).
If incomplete = FALSE
, sonority()
will (attempt) to fill in missing
but "implied" triad notes, note like missing 5ths.
By default, sonority()
will interpret the spelling of notes strictly, so a
"mispelled" triad, like B, E♭, F♯ will be interpreted as something weird—in this case
an augmented Eb chord with no third and a sharp 9!
Note that in the case of cross relations—for example,
B♭ and B♮ in the same chord—sonority()
will simply ignore the later species that appears.
However, if enharmonic = TRUE
, sonority()
will reinterpret input notes
by collapsing them into a single diatonic set on the circle-of-fifths.
This means that the set B, Eb, F♯ will be interpreted as B, D♯, F♯
and the set B♭, D, F, B♮ will be interpreted as B♭, D, F, C♭.
sonority(c('C', 'e', 'g', 'b-'))
sonority(c('G', 'BB', 'd', 'f', 'a'))
sonority(c('C', 'b-', 'd', 'f'))
sonority(c('C', 'b-', 'd', 'f'), inversions = FALSE)
## Not run:
chorales <- readHumdrum(humdrumRroot, 'HumdrumData/BachChorales/.*krn')
chorales <- within(chorales, dataTypes = 'Dd', ditto(Token) -> Token_dittoed)
within(chorales, sonority(Token_dittoed))
within(chorales, sonority(Token_dittoed, deparser = harm))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.