This function represents an input object as a
sparse frequency spectrum.
sparse_fr_spectrum(x, ...)
# S3 method for sparse_fr_spectrum
sparse_fr_spectrum(x, ...)
# S3 method for sparse_pi_spectrum
sparse_fr_spectrum(x, ...)
# S3 method for pi_chord
sparse_fr_spectrum(x, ...)
# S3 method for default
sparse_fr_spectrum(x, ...)
# S3 method for list
sparse_fr_spectrum(x, ...)
Arguments
x |
Input sonority.
Numeric vectors will be treated as vectors of MIDI note numbers,
and expanded into their implied harmonics.
Two-element lists will be treated as finalised spectra.
The first element should be labelled "frequency",
and correspond to a numeric vector of frequencies;
the second element should be labelled "amplitude",
and correspond to a numeric vector of amplitudes.
|
... |
Arguments passed on to expand_harmonics
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.
|
Value
An object of class sparse_fr_spectrum
.
Details
A sparse frequency spectrum comprises a finite set of spectral components,
each defined by a frequency (in Hz)
and an amplitude (expressed in arbitrary units, but with the
fundamental frequencies of chord pitches typically taking the value 1).