generateHarmonics: Generate harmonics

Description Usage Arguments Details Examples

View source: R/source.R

Description

Internal soundgen function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
generateHarmonics(pitch, attackLen = 50, nonlinBalance = 0, nonlinDep = 0,
  jitterDep = 0, jitterLen = 1, vibratoFreq = 100, vibratoDep = 0,
  shimmerDep = 0, creakyBreathy = 0, rolloff = -18, rolloffOct = -2,
  rolloffKHz = -6, rolloffParab = 0, rolloffParabHarm = 3,
  rolloffLip = 6, rolloff_perAmpl = 12, temperature = 0,
  pitchDriftDep = 0.5, pitchDriftFreq = 0.125,
  randomWalk_trendStrength = 0.5, shortestEpoch = 300, subFreq = 100,
  subDep = 0, amDep = 0, amFreq = 30, amplAnchors = NA, overlap = 75,
  samplingRate = 16000, pitchFloor = 75, pitchCeiling = 3500,
  pitchSamplingRate = 3500, throwaway = -120)

Arguments

pitch

a contour of fundamental frequency (numeric vector). NB: for computational efficiency, provide the pitch contour at a reduced sampling rate pitchSamplingRate, eg 3500 points/s. The pitch contour will be upsampled before synthesis.

attackLen

duration of fade-in / fade-out at each end of syllables and noise (ms)

nonlinBalance

hyperparameter for regulating the (approximate) proportion of sound with different regimes of pitch effects (none / subharmonics only / subharmonics and jitter). 0% = no noise; 100% = the entire sound has jitter + subharmonics. Ignored if temperature = 0

nonlinDep

hyperparameter for regulating the intensity of subharmonics and jitter, 0 to 100% (50% = jitter and subharmonics are as specified, <50% weaker, >50% stronger). Ignored if temperature = 0

jitterDep

cycle-to-cycle random pitch variation, semitones

jitterLen

duration of stable periods between pitch jumps, ms. Use a low value for harsh noise, a high value for irregular vibrato or shaky voice

vibratoFreq

the rate of regular pitch modulation, or vibrato, Hz

vibratoDep

the depth of vibrato, semitones

shimmerDep

random variation in amplitude between individual glottal cycles (0 to 100% of original amplitude of each cycle)

creakyBreathy

hyperparameter for a rough adjustment of voice quality from creaky (-1) to breathy (+1)

rolloff

basic rolloff at a constant rate of rolloff db/octave (exponential decay). See getRolloff for more details

rolloffOct

basic rolloff changes from lower to upper harmonics (regardless of f0) by rolloffOct dB/oct. For example, we can get steeper rolloff in the upper part of the spectrum

rolloffKHz

rolloff changes linearly with f0 by rolloffKHz dB/kHz. For ex., -6 dB/kHz gives a 6 dB steeper basic rolloff as f0 goes up by 1000 Hz

rolloffParab

an optional quadratic term affecting only the first rolloffParabHarm harmonics. The middle harmonic of the first rolloffParabHarm harmonics is amplified or dampened by rolloffParab dB relative to the basic exponential decay.

rolloffParabHarm

the number of harmonics affected by rolloffParab

rolloffLip

the effect of lip radiation on source spectrum, dB/oct (the default of +6 dB/oct produces a high-frequency boost when the mouth is open)

rolloff_perAmpl

as amplitude goes down from max to throwaway, rolloff increases by rolloff_perAmpl dB/octave. The effect is to make loud parts brighter by increasing energy in higher frequencies

temperature

hyperparameter for regulating the amount of stochasticity in sound generation

pitchDriftDep

scale factor regulating the effect of temperature on the amount of slow random drift of f0 (like jitter, but slower): the higher, the more f0 "wiggles" at a given temperature

pitchDriftFreq

scale factor regulating the effect of temperature on the frequency of random drift of f0 (like jitter, but slower): the higher, the faster f0 "wiggles" at a given temperature

randomWalk_trendStrength

try 0 to 1 - the higher, the more likely rw is to get high in the middle and low at the beginning and end (ie max effect amplitude in the middle of a sound)

shortestEpoch

minimum duration of each epoch with unchanging subharmonics regime, in ms

subFreq

target frequency of subharmonics, Hz (lower than f0, adjusted dynamically so f0 is always a multiple of subFreq)

subDep

the width of subharmonic band, Hz. Regulates how quickly the strength of subharmonics fades as they move away from harmonics in f0 stack. Low values produce narrow sidebands, high values produce uniformly strong subharmonics

amDep

amplitude modulation depth, modulation with amplitude range equal to the dynamic range of the sound

amFreq

amplitude modulation frequency, Hz

amplAnchors

a numeric vector of amplitude envelope (0 to 1) or a dataframe specifying the time (ms) and value of amplitude anchors

overlap

FFT window overlap, %

samplingRate

sampling frequency, Hz

pitchFloor

lower & upper bounds of f0

pitchCeiling

lower & upper bounds of f0

pitchSamplingRate

sampling frequency of the pitch contour only, Hz. Low values reduce processing time. A rule of thumb is to set this to the same value as pitchCeiling

throwaway

discard harmonics and noise that are quieter than this number (in dB, defaults to -120) to save computational resources

Details

Returns one continuous, unfiltered, voiced syllable consisting of several sine waves.

Examples

1
2
3
4
5
pitch=soundgen:::getSmoothContour(len = 3500,
  anchors = data.frame('time' = c(0, 1), 'value' = c(200, 300)))
plot(pitch)
sound = soundgen:::generateHarmonics(pitch, samplingRate = 16000)
# playme(sound, samplingRate = 16000) # no formants yet

tatters/soundgen_beta documentation built on May 14, 2019, 9 a.m.