
This function is a Butterworth frequency filter that filters out a selected frequency section of of a time wave (low-pass, high-pass, low-stop, high-stop, bandpass or bandstop frequency filter).
bwfilter(wave, f, n = 1, from = NULL, to = NULL,
bandpass = TRUE, listen = FALSE, output = "matrix")
an R object.
sampling frequency of wave
(in Hz). Does not need to be specified if embedded in wave
.
Order of the filter. See details.
start frequency (in Hz) where to apply the filter.
end frequency (in Hz) where to apply the filter.
if TRUE
a band-pass filter is applied between
from
and to
, if not NULL
a band-stop filter is applied
between from
and to
(by default NULL
).
if TRUE
the new sound is played back.
character string, the class of the object to return, either
"matrix"
, "Wave"
, "Sample"
, "audioSample"
or "ts"
.
A new wave is returned. The class
of the returned object is set with the argument output
.
The order of the filter determines the value of the roll-off value, that is the dB decrease per octave of the transfer function. A filter of order n will have a transfer function with a roll-off value of - n*6 dB.
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.
# NOT RUN {
require(signal)
f <- 8000
a <- noisew(f=f, d=1)
## low-pass
# 1st order filter
res <- bwfilter(a, f=f, n=1, to=1500)
# 8th order filter
res <- bwfilter(a, f=f, n=8, to=1500)
## high-pass
res <- bwfilter(a, f=f, from=2500)
## band-pass
res <- bwfilter(a, f=f, from=1000, to=2000)
## band-stop
res <- bwfilter(a, f=f, from=1000, to=2000,bandpass=FALSE)
# }
Run the code above in your browser using DataLab