View source: R/sparse-pi-spectrum.R
sparse_pi_spectrum | R Documentation |
This function represents an input object as a sparse pitch spectrum.
sparse_pi_spectrum(x, ...)
## S3 method for class 'sparse_pi_spectrum'
sparse_pi_spectrum(x, ...)
## S3 method for class 'sparse_fr_spectrum'
sparse_pi_spectrum(x, ...)
## S3 method for class 'list'
sparse_pi_spectrum(x, ...)
## Default S3 method:
sparse_pi_spectrum(x, ...)
## S3 method for class 'pi_chord'
sparse_pi_spectrum(x, amplitude = 1, coherent = FALSE, ...)
x |
Input sonority. |
... |
Arguments passed on to
|
amplitude |
(Numeric vector) Vector of amplitudes to assign to each pitch. If a scalar value is provided, this value is assigned to all pitches |
coherent |
Whether the amplitudes from different spectral components should be combined
assuming coherent summation, where the amplitudes simply add together
(default is |
A sparse pitch spectrum describes an input sonority as a finite set of spectral components, each defined by a pitch (expressed on the MIDI pitch scale) and an amplitude (expressed in arbitrary units, but with the fundamental frequencies of chord pitches typically taking the value 1).
A sparse pitch spectrum is most easily created by coercion from
a different chord representation. If a numeric vector is provided as the input,
it is treated as a pi_chord
representation, for example
sparse_pi_spectrum(c(60, 64, 67))
will create a sparse pitch spectrum
by expanding the harmonics implied by a C major triad.
A sparse pitch spectrum can also be created directly by providing a list
with two elements, the first being labelled "pitch", and the second labelled "amplitude",
each of which being numeric vectors of the same length.
In this case no harmonic expansion is performed.
The first element will be taken as a vector of pitches,
and the second element will be taken as a vector of corresponding amplitudes.
For example, one might write
sparse_pi_spectrum(list(pitch = c(60, 72, 79), amplitude = c(3, 2, 1)))
.
An object of class sparse_pi_spectrum
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.