Learn R Programming

schoenberg (version 2.0.3)

rekey: Re-express a "schoenberg" class object with a different lead tone or different notation of accidentals.

Description

Re-express a "schoenberg" class object with a different lead tone or different notation of accidentals.

Usage

rekey(tone_mat, tone0 = NULL, accidentals = NULL)

Value

A 12-tone matrix of the "schoenberg" class with prime series on the rows and inverted series on the columns.

Arguments

tone_mat

Object of the class "schoenberg" produced by the schoenberg() function.

tone0

Optional: Name of the note to use as the lead tone of the matrix.

accidentals

Optional: Character scalar that determines whether accidentals should be represented as sharps (accidentals = "sharps") or flats (accidentals = "flats"); default value is NULL. accidentals can also be set to "integers" when one wishes to obtain a 12-tone matrix of numeric indices rather than notes. When accidentals is NULL, matrices created from pre-specified vectors of notes will use the original set of accidentals, whereas random matrices and matrices created from vectors of numeric indices will default to sharp notation.

Examples

Run this code
# Let's create a vector of notes to use in creating our inital 'tone_mat' matrix based
# on Schoenberg's Walzer from Opus 23
prime01 <- c("C#", "A", "B", "G", "Ab", "F#", "A#", "D", "E", "Eb", "C", "F")
tone_mat <- schoenberg(prime0 = prime01)

# Now, let's change the lead tone to "C":
rekey(tone_mat = tone_mat, tone0 = "C")

# And let's also change the accidentals to flats:
rekey(tone_mat = tone_mat, tone0 = "C", accidentals = "flats")

Run the code above in your browser using DataLab