Learn R Programming

seewave (version 1.5.2)

echo: Echo generator

Description

This function generate echoes of a time wave.

Usage

echo(wave, f, amp, delay, 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
amp
a vector describing the relative amplitude of the successive echoes. Each value of the vector should in [0,1]
delay
a vector describing the time delays of the successive echoes from the beginning of wave (in s.)
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

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

Details

amp and delay should strictly have the same length corresponding to the number of desired echoes.

References

Stoddard, P. K. (1998). Application of filters in bioacoustics. In: Hopp, S. L., Owren, M. J. and Evans, C. S. (Eds), Animal acoustic communication. Springer, Berlin, Heidelberg,pp. 105-127.

See Also

synth

Examples

Run this code
# generation of the input wave
a<-synth(f=11025,d=1,cf=2000,shape="tria",am=c(50,10),fm=c(1000,10,1000))
# generation of three echoes
# with respectively a relative amplitude of 0.8, 0.4, and 0.2
# and with a delay of 1s, 2s, and 3s  from the beginning of the input wave
aecho<-echo(a,f=11025,amp=c(0.8,0.4,0.2),delay=c(1,2,3))
# oscillographic output to see what we have generated
op<-par(mfrow=c(2,1))
oscillo(a,f=11025,title="Input signal")
oscillo(aecho,f=11025,colwave="blue",title="Signal with echoes",coltitle="blue")
par(op)
# another echo with time delays overlapping with the input wave
echo(a,f=11025,amp=c(0.4,0.2,0.4),delay=c(0.6,0.8,1.5),plot=TRUE,listen=TRUE)

Run the code above in your browser using DataLab