| getRolloff | R Documentation |
A periodic sound often contains many harmonics of the fundamental frequency
(f0). For instance, soundgen generates voice source as a
combination of pure tones - one for each partial in the source spectrum.
Harmonics typically become weaker at higher frequencies, and the rolloff
(roll-off) function describes the loss of energy in upper harmonics relative
to f0. getRolloff provides flexible control over this rolloff
function: simple exponential (rolloff), rolloffOct that varies
per octave, and rolloffKHz for rolloff correction depending on f0. It
calculates the rolloff function based on these parameters and returns the
amplitude of each harmonic.
getRolloff(
pitch_per_gc = c(440),
nHarmonics = 1000,
rolloff = -6,
rolloffOct = 0,
rolloffKHz = 0,
baseline = 200,
dynamicRange = 80,
samplingRate = 16000,
plot = FALSE
)
pitch_per_gc |
a vector of f0 per glottal cycle, Hz |
nHarmonics |
maximum number of harmonics or partials to generate,
including f0 (all harmonics above Nyquist frequency or with amplitude <
|
rolloff |
the rate at which f0 harmonics in the spectrum become weaker, dB/oct (anchor format for all rolloff-related parameters). More negative rolloff = weaker upper harmonics |
rolloffOct, rolloffKHz |
rolloff may be constant throughout the spectrum, or it may vary with each octave above f0 (rolloffOct) or per kHz increase in f0 above the baseline of 200 Hz (rolloffKHz); for both parameters, positive values mean the rate of rolloff increases toward upper frequencies) |
baseline |
The "neutral" f0, at which no adjustment of rolloff
takes place regardless of |
dynamicRange |
dynamic range (dB). Harmonics and noise more than dynamicRange under maximum amplitude are discarded to save computational resources |
samplingRate |
sampling rate (needed to stop at Nyquist frequency and for plotting purposes) |
plot |
if TRUE, produces a plot |
A matrix of amplitude multiplication factors for adjusting the amplitude of harmonics relative to f0 (1 = no adjustment, 0 = silent). Each row of output contains one harmonic, and each column contains one glottal cycle.
soundgen
# steady exponential rolloff of -12 dB per octave
rolloff1 = getRolloff(pitch_per_gc = 150, rolloff = -12,
rolloffOct = 0, rolloffKHz = 0, plot = TRUE)
# the rate of rolloff slows down by 1 dB each octave
r = getRolloff(pitch_per_gc = 100, rolloff = -6, rolloffOct = 0)
r1 = getRolloff(pitch_per_gc = 100, rolloff = -6, rolloffOct = -1)
round(20*log10(r[c(1, 2, 4, 8, 16)]), 1)
round(20*log10(r1[c(1, 2, 4, 8, 16)]), 1)
# rolloff can be made to depend on f0 using rolloffKHz
rolloff = getRolloff(pitch_per_gc = c(150, 400, 800),
rolloffOct = 0, rolloffKHz = -3, plot = TRUE)
# without the correction for f0 (rolloffKHz),
# high-pitched sounds have the same rolloff as low-pitched sounds,
# producing unnaturally strong high-frequency harmonics
rolloff = getRolloff(pitch_per_gc = c(150, 400, 800),
rolloffOct = 0, rolloffKHz = 0, plot = TRUE)
# dynamic rolloff (varies over time)
rolloff = getRolloff(pitch_per_gc = c(150, 250),
rolloff = c(-12, -18, -24), plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.