| synth2 | R Documentation |
This functions synthesizes pure tone sound based on an amplitude envelope and an instantaneous frequency contour. The function can also be used to modify a reference sound.
synth2(env = NULL, ifreq, f, plot = FALSE, listen = FALSE, output = "matrix", ...)
env |
a numeric vector describing the amplitude envelope
(i.e. the amplitude modulation). By default |
ifreq |
a numeric vector describing the instantaneous frequency (in Hz). |
f |
a numeric vector for the sampling frequency (in Hz) |
plot |
if |
listen |
if |
output |
character string, the class of the object to return, either
|
... |
other |
env and ifreq must have exactly the same
length.
The amplitude envelope can be obtained with the Hilbert envelope
(function env) and the instantaneous frequency can be
obtained with the Hilbert transform (function
ifreq). This opens a great variety of signal
modidications as shown in the example section.
If plot is FALSE, a new wave is returned. The class
of the returned object is set with the argument output.
Jérôme Sueur and Laurent Lellouch
Beeman, K. 1998 Digital signal analysis, editing and synthesis, in Animal acoustic communication edited by Hopp SL, Owren MJ, Evans CS, Springer, 59-103.
synth2, noisew, pulse, echo
## You can use plot=TRUE and spectro() options
## to directly 'see' the new-built sounds
## MODIFICATION OF A REFERENCE SIGNAL
data(tico)
env.tico <- env(tico, f=22050, plot=FALSE)
ifreq.tico <- ifreq(tico, f=22050, plot=FALSE)$f[,2]
# recover the original signal
s <- synth2(env=env.tico, ifreq=ifreq.tico*1000, f=22050)
# original signal with instantaneous frequency reversed
s <- synth2(env=env.tico, ifreq=rev(ifreq.tico)*1000, f=22050)
# original signal with a +1000 Hz linear frequency shift
s <- synth2(env=env.tico, ifreq=ifreq.tico*1000+1000, f=22050)
# original signal with instantaneous frequency multiplied by 2
s <- synth2(env=env.tico, ifreq=ifreq.tico*1000*2, f=22050)
# original signal with a linear instantaneous frequency at 2000 Hz
s <- synth2(env=env.tico, ifreq=rep(2000, times=length(tico@left)), f=22050)
## DE NOVO SYNTHESIS
# instantaneous frequency increasing by step of 500 Hz
s <- synth2(ifreq=rep(c(500,1000,1500,2000,2500,3000,3500,4000), each=2000), f=16000)
# square function of the instantaenous frequency
s <- synth2(ifreq=500+seq(-50,50, length.out=8000)^2, f=8000)
# linear increase of the amplitude envelope
s <- synth2(env=seq(0,1,length=8000), ifreq=rep(2000,8000), f=8000)
# square-root increase of the amplitude envelope
s <- synth2(env=sqrt(seq(0,1,length=8000)), ifreq=rep(2000,8000), f=8000)
# square-root increase and decrease of the amplitude envelope
s <- synth2(env=c(sqrt(seq(0,1,length=4000)), sqrt(seq(1,0,length=4000))),
ifreq=rep(2000,8000), f=8000)
# amplitude envelope and instantaneous frequency following a normal density shape
norm <- rep(dnorm(-4000:3999, sd=1000), 2)
s <- synth2(env=norm, ifreq=500+(norm/max(norm))*1000, f=8000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.