soundgen (version 1.5.0)

generateGC: Generate glottal cycles

Description

Internal soundgen function. Takes descriptives of a number of glottal cycles (f0, closed phase, rolloff - note that all three should be vectors of the same length, namely nGC) and creates a waveform consisting of a string of these glottal cycles separated by pauses (if there is a closed phase). The principle is to work with one glottal cycle at a time and create a sine wave for each harmonic, with amplitudes adjusted by rolloff.

Usage

generateGC(pitch_per_gc, glottisClosed_per_gc, rolloff_per_gc,
  samplingRate, wn = "none")

Arguments

pitch_per_gc

pitch per glottal cycle, Hz

glottisClosed_per_gc

proportion of closed phase per glottal cycle, %

rolloff_per_gc

a list of one-column matrices, one for each glottal cycle, specifying rolloff per harmonic (linear multiplier, ie NOT in dB) Each matrix has as many rows as there are harmonics, and rownames specify the ratio to F0 (eg 1.5 means it's a subharmonic added between f0 and its first harmonic)

samplingRate

the sampling rate of generated sound, Hz

wn

windowing function applied to each glottal cycle (see ftwindow_modif)

Value

Returns a waveform as a non-normalized numeric vector centered at zero.

Examples

Run this code
# NOT RUN {
pitch_per_gc = seq(100, 150, length.out = 25)
glottisClosed_per_gc = seq(0, 300, length.out = 25)
m = matrix(10 ^ (-6 * log2(1:200) / 20))
rownames(m) = 1:nrow(m)
rolloff_per_gc = rep(list(m), 25)
s = soundgen:::generateGC(pitch_per_gc, glottisClosed_per_gc,
                          rolloff_per_gc, samplingRate = 16000)
# plot(s, type = 'l')
# playme(s)
# }

Run the code above in your browser using DataLab