Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

squarefilter

Frequency square filter


Description

This function prepares the amplitude profile of a square frequency filter.

Usage

squarefilter(f, from = NULL, to = NULL, bandpass = TRUE, wl = 1024)

Arguments

f

a numeric vector of length 1 for the sampling frequency of the object to be filtered (in Hz).

from

a numeric vector for the start frequencies (in Hz) where to apply the filter.

to

a numeric vector of the end frequencies (in Hz) where to apply the filter.

bandpass

if TRUE a band-pass filter is prepared between start and end frequencies (arguments from and to), if FALSE a bandstop filter is prepared.

wl

window length of the impulse filter (even number of points).

Value

The function returns a two-column matrix, the first column is the frequency in kHz and the second column is the amplitude of the filter (frequency response of the filter).

Note

This function can be used to prepare bandpass or bandstop filters to be used with fir and ffilter. See examples.

Author(s)

Laurent Lellouch

See Also

Examples

f <- 44100
a <- noisew(f = f, d = 1)
p <- squarefilter(f, from = c(100, 1000, 4000), to = c(500, 3000, 8000))
plot(p, type="l")
h <- fir(a, f = f, custom = p, wl = 1024, output = 'Wave')
spectro(h)

seewave

Sound Analysis and Synthesis

v2.1.6
GPL (>= 2)
Authors
Jerome Sueur <sueur@mnhn.fr> [cre, au], Thierry Aubin [au], Caroline Simonis [au], Laurent Lellouch [main ctrb], Ethan C. Brown [ctrb], Marion Depraetere [ctrb], Camille Desjonqueres [ctrb], Francois Fabianek [ctrb], Amandine Gasc [ctrb], Eric Kasten [ctrb], Stefanie LaZerte [ctrb], Jonathan Lees [ctrb], Jean Marchal [ctrb], Andre Mikulec [ctrb], Sandrine Pavoine [ctrb], David Pinaud [ctrb], Alicia Stotz [ctrb], Luis J. Villanueva-Rivera [ctrb], Zev Ross [ctrb], Carl G. Witthoft [ctrb], Hristo Zhivomirov [ctrb].
Initial release
2020-06-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.