cps_chord_table: Create CPS Chord Table

View source: R/cps_functions.R

cps_chord_tableR Documentation

Create CPS Chord Table

Description

Creates a chord table for a combination product set scale based on an even number of harmonic factors.

Usage

cps_chord_table(scale_table)

Arguments

scale_table

a CPS scale table based on an even number of harmonic factors. It will abort via

stop("number of harmonic factors must be even!")

if it receives one with an odd number.

Details

The algorithm used only works for a combination product set built from an even number of harmonic factors, so it aborts if it receives one with an odd number.

In the following, the symbol ⁠n)m⁠ is Erv Wilson's notation for the number of combinations of m items taken n at a time. n_harmonics is the number of harmonic factors, the resulting chords will have choose <- n_harmonics / 2 + 1 notes. There will be ⁠choose)n_harmonics⁠ "harmonic" chords and ⁠choose)n_harmonics⁠ "sub-harmonic" chords.

Value

a data.table with four columns:

  • chord: the chord expressed as colon-separated harmonics. A subharmonic chord is prefixed with a "~".

  • degrees: the chord expressed as colon-separated scale degrees

  • chord_index: the row number of the chord in the combination output

  • is_subharm: zero if it's harmonic, one if it's subharmonic.

The resulting data.table is sorted into harmonic-subharmonic pairs using data.table::setkey.

Examples


# compute the tetrads of the 1-3-5-7-9-11 Eikosany
eikosany <- cps_scale_table(root_divisor = 33)
print(eikosany_chords <- cps_chord_table(eikosany))

# compute the pentads of the 1-3-5-7-9-11-13-15 Hebdomekontany
hebdomekontany <- cps_scale_table(
  harmonics = c(1, 3, 5, 7, 9, 11, 13, 15),
  choose = 4,
  root_divisor = 3 * 5 * 7
)
print(hebdomekontany_chords <- cps_chord_table(hebdomekontany))

AlgoCompSynth/eikosany documentation built on Nov. 25, 2024, 5:22 p.m.