Expands each tone in an object into its implied harmonics.

expand_harmonics(
  x,
  num_harmonics = 11L,
  roll_off = 1,
  digits = 6,
  label_harmonics = FALSE,
  coherent = FALSE
)

# S3 method for sparse_fr_spectrum
expand_harmonics(
  x,
  num_harmonics = 11L,
  roll_off = 1,
  digits = 6,
  label_harmonics = FALSE,
  coherent = FALSE
)

# S3 method for sparse_pi_spectrum
expand_harmonics(
  x,
  num_harmonics = 11L,
  roll_off = 1,
  digits = 6,
  label_harmonics = FALSE,
  coherent = FALSE
)

# S3 method for pi_chord
expand_harmonics(
  x,
  num_harmonics = 11L,
  roll_off = 1,
  digits = 6,
  label_harmonics = FALSE,
  coherent = FALSE
)

Arguments

x

Object whose harmonics should be expanded. Should be of class sparse_pi_spectrum, sparse_fr_spectrum, or pi_chord.

num_harmonics

(Integerish scalar) Number of harmonics (including the fundamental) to which each tone should be expanded.

roll_off

(Numeric scalar) Parametrises the amount of amplitude roll-off in the harmonics, with greater values corresponding to higher roll-off.

digits

Number of digits to which each partial's MIDI pitch should be rounded.

label_harmonics

If TRUE, then the harmonics in the resulting spectrum are labelled with their harmonic numbers.

coherent

Whether the amplitudes from different spectral components should be combined assuming coherent summation, where the amplitudes simply add together (default is FALSE). Otherwise incoherent summation is used, where the amplitudes are squared, added, then square rooted.