Description Usage Arguments Details Value Note Examples
Generates an optimized voicing for a chord sequence.
1 2 3 |
x |
Chord sequence to voice.
This should take the form of a |
opt |
A list of options as created by |
fix_melody |
A numeric vector specifying the desired melody notes (i.e. top line) for the voicing, as MIDI pitches. The ith element should correspond to the melody note for the ith chord of x. NA values mean that the melody is unconstrained. |
fix_content |
A list of potentially empty numeric vectors specifying pitches that must be included in the corresponding chords of x. Can be used to produce melodies internal to the texture. |
fix_chords |
A list of voicings to fix in advance within the generated result, each given as numeric vectors of MIDI pitches. A NULL element means that the voicing for the corresponding chord is unconstrained. Note that specifying a voicing manually overrides all other voicing options (e.g. range limits), and the voicing will be accepted even if it is incompatible with the corresponding element of x. |
By default, the algorithm optimizes the sum of the linear predictors
for each chord transition.
By setting the exp_cost
, norm_cost
, and log_cost
arguments of voice_opt
to TRUE
,
it is possible alternatively to optimize the probability of the sequence.
A voiced chord sequence,
represented as a vec
object
with type pi_chord
.
This object can be inspected using as.list
.
Voicing sequences of type pi_chord
preserves
the original bass pitch classes.
The original doublings for each pitch class can also be preserved
by setting dbl_change = TRUE
in voice_opt
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(magrittr)
library(hrep)
chords <- list(
pc_chord(c(0, 4, 7)),
pc_chord(c(0, 5, 9)),
pc_chord(c(2, 7, 11))
) %>%
vec("pc_chord")
voice(chords,
voice_opt(min_notes = 3, max_notes = 3))
voice(chords,
voice_opt(min_notes = 3, max_notes = 3),
fix_melody = c(76, 77, 79))
voice(chords,
voice_opt(min_notes = 3, max_notes = 4),
fix_content = list(c(60, 72), c(65, 77), c(67, 79)))
voice(chords,
voice_opt(min_notes = 3, max_notes = 3),
fix_chords = list(NULL, c(53, 57, 60), NULL))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.