combfilter | R Documentation |
This function processes a feedforward comb filter and plots a spectrogram of the filtered wave asso- ciated with the frequency response of the filter.
combfilter(wave, f, channel = 1, alpha, K, units = c("samples", "seconds"),
plot = FALSE, output = "matrix", ...)
wave |
an |
f |
sampling frequency (in Hz). Does not need to be specified if
embedded in |
channel |
channel of the R object, by default left channel (1). |
alpha |
a numeric vector of length 1 for the scaling factor. See Details. |
K |
a numeric vector of lenght 1 for the delay length, in
|
units |
units in which |
plot |
a logical, if |
output |
character string, the class of the object to return,
either |
... |
other arguments to be passed to |
A comb filter consists in adding a delayed version of a signal to itself resulting in constructive and destructive interference. The feedforward version of a comb filter can be written following:
y(n) = x(n) + \alpha \times x(n - K)
where alpha is the scaling factor and K the delay length. The frequency response of the filter is obtained with:
H(f) = \sqrt{(1+\alpha^2)+2 \times \cos(\omega K)}
The frequency response is periodic. The depth of the cycles is controlled with alpha and the number of cycles with K.
A new wave is returned. The class of the returned object is set with the argument output
.
Setting K to high values may generate unwanted results.
The feedback form of the combfilter is not implemented yet.
Jerome Sueur
combfilter
, fir
, squarefilter
, drawfilter
, ffilter
, bwfilter
## Not run:
f <- 44100
## chirp
s1 <- synth(f=f, cf=1, d=2, fm=c(0,0,f/2,0,0), out="Wave")
combfilter(s1, alpha=1, K=50, plot=TRUE)
## harmonic sound
s2 <- synth(f=f, d=2, cf=600, harmonics=rep(1, 35), output="Wave")
combfilter(s2, alpha=1, K=10, plot=TRUE)
## noise, units in seconds
s3 <- noisew(d=2, f=44100, out="Wave")
combfilter(s3, alpha=0.5, K=1e-4, units="seconds", plot=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.