setenv {seewave}R Documentation

Set the amplitude envelope of a time wave to another one

Description

This function sets the amplitude envelope of a time wave to another one

Usage

setenv(wave1, wave2, f, smooth = NULL, ksmooth = NULL, plot = FALSE,
listen = FALSE, Sample = FALSE, ...)

Arguments

wave1 data or a Sample object generated loading a wav file with loadSample (package sound) describing the time wave which amplitude envelope has to be changed.
wave2 data or a Sample object generated loading a wav file with loadSample (package sound) describing the time wave which envelop will be obtained and set to wave1.
f sampling frequency of wave1 and wave2 (in Hz). Does not need to be specified if wave1 and/or wave2 are/is (a) Sample object(s).
smooth if env is TRUE then smoothes the envelope of wave2 by floating average.
ksmooth if env is TRUE then smoothes the envelope of wave2 by applying a kernel smoothing.
plot if TRUE returns the oscillogram of the new time wave (by default FALSE).
listen if TRUE the new sound is played back.
Sample if TRUE and plot is FALSE returns an object of class Sample.
... other oscillo graphical parameters.

Details

wave1 and wave2 can have different duration (length)
Smoothing the envelope with smooth or ksmooth can significantly change the value returned.

Value

If plot is FALSE, a new wave is returned as a one-column matrix or as a Sample object if Sample is TRUE.

Author(s)

Jérôme Sueur sueur@mnhn.fr

See Also

oscillo, synth

Examples

data(tico)
a<-synth(d=1,f=22050,cf=1000)
# apply 'tico' ammplitude envelope to 'a' that has a square amplitude envelope
setenv(a,tico,f=22050,plot=TRUE)
# the same but with smoothing the envelope
setenv(a,tico,f=22050,ksmooth=kernel("daniell",50),plot=TRUE)

[Package seewave version 1.4.7 Index]