Learn R Programming

seewave (version 1.7.0)

synth2: Synthesis of time wave (tonal model)

Description

This functions synthesizes pure tone sound based on an amplitude envelope and and instantaneous frequency. The function can also be used to modified a reference sound.

Usage

synth2(env = NULL, ifreq, f, plot = FALSE, listen = FALSE, output = "matrix", ...)

Arguments

Value

  • If plot is FALSE, a new wave is returned. The class of the returned object is set with the argument output.

Details

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.

References

Beeman, K. 1998 Digital signal analysis, editing and synthesis, in Animal acoustic communication edited by Hopp SL, Owren MJ, Evans CS, Springer, 59-103.

See Also

synth2, noisew, pulse, echo

Examples

Run this code
## 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
synth2(env=env.tico, ifreq=ifreq.tico*1000, f=22050, plot=TRUE)
# original signal with instantaneous frequency reversed
synth2(env=env.tico, ifreq=rev(ifreq.tico)*1000, f=22050, plot=TRUE)
# original signal with a +1000 Hz linear frequency shift
synth2(env=env.tico, ifreq=ifreq.tico*1000+1000, f=22050, plot=TRUE)
# original signal with instantaneous frequency multiplied by 2
synth2(env=env.tico, ifreq=ifreq.tico*1000*2, f=22050, plot=TRUE)
# original signal with a linear  instantaneous frequency at 2000 Hz
synth2(env=env.tico, ifreq=rep(2000, times=length(tico@left)), f=22050, plot=TRUE)

## DE NOVO SYNTHESIS
# instantaneous frequency increasing by step of 500 Hz
synth2(ifreq=rep(c(500,1000,1500,2000,2500,3000,3500,4000), each=2000), f=16000, plot=TRUE)
# square function of the instantaenous frequency
synth2(ifreq=500+seq(-50,50, length.out=8000)^2, f=8000, plot=TRUE, ovlp=85)
# linear increase of the amplitude envelope
synth2(env=seq(0,1,length=8000), ifreq=rep(2000,8000), f=8000, plot=TRUE, ovlp=85, osc=TRUE)
# square-root increase of the amplitude envelope
synth2(env=sqrt(seq(0,1,length=8000)), ifreq=rep(2000,8000), f=8000, plot=TRUE, ovlp=85, osc=TRUE)
# square-root increase and decrease of the amplitude envelope
synth2(env=c(sqrt(seq(0,1,length=4000)), sqrt(seq(1,0,length=4000))),
    ifreq=rep(2000,8000), f=8000, plot=TRUE, ovlp=85, osc=TRUE)
# amplitude envelope and instantaneous frequency following a normal density shape
norm <- rep(dnorm(-4000:3999, sd=1000), 2)
toto <- synth2(env=norm, ifreq=500+(norm/max(norm))*1000, f=8000, plot=TRUE, osc=TRUE, ovlp=85)

Run the code above in your browser using DataLab