Learn R Programming

seewave (version 1.5.2)

fadew: Fade in and fade out of a time wave

Description

This function applies a fade in and/or a fade out to a time wave following a linear, exponential or cosinus-like shape.

Usage

fadew(wave, f, din = 0, dout = 0, shape = "linear", plot = FALSE,
listen = FALSE, Sample = FALSE, ...)

Arguments

wave
a vector, a matrix (first column), an object of class ts, Sample (left channel), or Wave (left channel).
f
sampling frequency of wave (in Hz). Does not need to be specified if wave is an object of class ts, Sample, or Wave
din
fade in duration
dout
fade out duration
shape
fade shape, "linear", "exp" for exponential, "cos" for cosinus-like, (by default "linear")
plot
logical, if TRUE returns an oscillographic plot of the wave modified (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.

Value

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

See Also

oscillo, addsilw, cutw, deletew,mutew, pastew, revw, zapsilw

Examples

Run this code
a<-noise(d=5,f=4000)
op<-par(mfrow=c(3,1))
fadew(a,f=4000,din=1,dout=2,plot=TRUE,title="Linear",cexlab=0.8)
fadew(a,f=4000,din=1,dout=2,shape="exp",plot=TRUE,title="Exponential shape",
    colwave="blue",coltitle="blue",cexlab=0.8)
fadew(a,f=4000,din=1,dout=2,shape="cos",plot=TRUE,title="Cosinus-like shape",
    colwave="red",coltitle="red",cexlab=0.8)
par(op)

Run the code above in your browser using DataLab