bwfilter {seewave} | R Documentation |
Butterworth frequency filter
Description
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).
Usage
bwfilter(wave, f, channel = 1, n = 1, from = NULL, to = NULL,
bandpass = TRUE, listen = FALSE, output = "matrix")
Arguments
wave |
an R object. |
f |
sampling frequency of |
channel |
channel of the R object, by default left channel (1). |
n |
Order of the filter. See details. |
from |
start frequency (in Hz) where to apply the filter. |
to |
end frequency (in Hz) where to apply the filter. |
bandpass |
if |
listen |
if |
output |
character string, the class of the object to return, either
|
Details
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.
Value
A new wave is returned. The class
of the returned object is set with the argument output
.
Note
This function mainly uses the functions filter()
and
filtfilt()
from the package signal
Author(s)
Jerome Sueur, functions filter()
and
filtfilt()
from the package signal
.
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
ffilter
, bwfilter
, preemphasis
, lfs
, afilter
Examples
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)