# NOT RUN {
# [a] with F1-F3 visible
e = getSpectralEnvelope(nr = 512, nc = 50, duration = 300,
formants = soundgen:::convertStringToFormants('a'),
temperature = 0, plot = TRUE)
# image(t(e)) # to plot the output on a linear scale instead of dB
# some "wiggling" of specified formants plus extra formants on top
e = getSpectralEnvelope(nr = 512, nc = 50,
formants = soundgen:::convertStringToFormants('a'),
temperature = 0.1, formantDepStoch = 20, plot = TRUE)
# a schwa based on variable length of vocal tract
e = getSpectralEnvelope(nr = 512, nc = 100, formants = NA,
vocalTract = list(time = c(0, .4, 1), value = c(13, 18, 17)),
temperature = .1, plot = TRUE)
# no formants at all, only lip radiation
e = getSpectralEnvelope(nr = 512, nc = 50, lipRad = 6,
formants = NA, temperature = 0, plot = FALSE)
plot(e[, 1], type = 'l') # linear scale
plot(20 * log10(e[, 1]), type = 'l') # dB scale - 6 dB/oct
# mouth opening
e = getSpectralEnvelope(nr = 512, nc = 50,
vocalTract = 16, plot = TRUE, lipRad = 6, noseRad = 4,
mouth = data.frame(time = c(0, .5, 1), value = c(0, 0, .5)))
# dynamic VTL
e = getSpectralEnvelope(nr = 512, nc = 50, formants = 'a',
vocalTract = c(15, 17.5, 18), plot = TRUE)
# scale formant amplitude and/or bandwidth
e1 = getSpectralEnvelope(nr = 512, nc = 50,
formants = soundgen:::convertStringToFormants('a'),
formantWidth = 1, formantDep = 1) # defaults
e2 = getSpectralEnvelope(nr = 512, nc = 50,
formants = soundgen:::convertStringToFormants('a'),
formantWidth = 1.5, formantDep = 1.5)
plot(e2[, 1], type = 'l', col = 'red', lty = 2)
points(e1[, 1], type = 'l')
# manual specification of formants
e = getSpectralEnvelope(nr = 512, nc = 50, plot = TRUE, samplingRate = 16000,
formants = list(f1 = data.frame(time = c(0, 1), freq = c(900, 500),
amp = c(30, 35), width = c(80, 50)),
f2 = data.frame(time = c(0, 1), freq = c(1200, 2500),
amp = c(25, 30), width = 100),
f3 = data.frame(time = 0, freq = 2900,
amp = 30, width = 120)))
# }
Run the code above in your browser using DataLab