smoothw {seewave} | R Documentation |
A function to tentativily smooth a time wave
Description
This function tries to smooth with a sum sliding window a time wave, and then to remove residual noise.
Usage
smoothw(wave, f, channel = 1, wl, padding=TRUE, output = "matrix")
Arguments
wave |
an R object. |
f |
sampling frequency of |
channel |
channel of the R object, by default left channel (1). |
wl |
window length in number of points (samples). |
padding |
a logical, if |
output |
character string, the class of the object to return,
either |
Details
A window slides along the signal and sums up the sample amplitude values. Zero values are added at the end of the wave to keep wave length (duration).
Value
A new wave is returned. The class of the returned object is set
with the argument output
. If padding
is TRUE
, the
new wave starts and ends up with 0
values to match the size of wave
.
Warning
This function should be used with care as this kind of filter may change the frequency content of the sound. See the examples section for an illustration.
Author(s)
Jerome Sueur
See Also
Examples
# An example to show that smoothw() may change
# the frequency content of your sound
data(orni)
orni2 <- smoothw(orni, wl=2, out="Wave")
orni10 <- smoothw(orni, wl=10, out="Wave")
orni50 <- smoothw(orni, wl=50, out="Wave")
orni100 <- smoothw(orni, wl=100, out="Wave")
meanspec(orni)
lines(meanspec(orni2, plot=FALSE), col=2)
lines(meanspec(orni10, plot=FALSE), col=3)
lines(meanspec(orni50, plot=FALSE), col=4)
lines(meanspec(orni100, plot=FALSE), col=5)
legend("topright", col=1:5, lty=1, legend=c("original","wl=2","wl=10","wl=50","wl=100"))