generateGC: Generate glottal cycles

Description Usage Arguments Value Examples

View source: R/source.R

Description

Internal soundgen function. Takes descriptives of a number of glottal cycles (f0, closed phase, rolloff) 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

1
2
generateGC(pitch_per_gc, glottisClosed_per_gc, rolloff_per_gc,
  samplingRate)

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

Value

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

Examples

1
2
3
4
5
6
7
8
9
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_source = rep(list(m), 25)
s = soundgen:::generateGC(pitch_per_gc,  glottisClosed_per_gc,
                          rolloff_source,  samplingRate = 16000)
# plot(s, type = 'l')
# playme(s)

soundgen documentation built on Oct. 4, 2018, 9:04 a.m.