class RemiAudio::DSP::BiQuadFilter
- RemiAudio::DSP::BiQuadFilter
- Reference
- Object
Overview
Implements a digital biquad filter.
Defined in:
remiaudio/dsp/biquadfilter.crConstant Summary
-
RESONANCE_MAX =
1.0
-
The maximum resonance value.
-
RESONANCE_MIN =
Float64::MIN_POSITIVE
-
The minimum resonance value.
Constructors
-
.new(newSampleRate)
Creates a new
BiQuadFilter
.
Instance Method Summary
- #a1 : Float64
- #a2 : Float64
- #activate : Nil
-
#active=(active : Bool)
Whether or not the filter is currently active.
-
#active? : Bool
Whether or not the filter is currently active.
- #b0 : Float64
- #b1 : Float64
- #b2 : Float64
-
#clearBuffer : Nil
Clears the internal buffer
- #deactivate : Nil
-
#freq : Float64
The current frequency of the filter.
-
#gain : Float64
The current gain of the filter.
-
#mode : FilterMode
The current mode of the filter.
-
#plot(pt : PlotType, *, coeffsOnly : Bool = false) : String
Generates a string that can be passed to a program to plot this filter on a graph.
-
#postGain : Float64
The amount of gain to apply after the EQ, in decibels.
-
#postGain=(value : Float64) : Nil
The amount of gain to apply after the EQ, in decibels.
-
#process(sample : Float64) : Float64
Processes a single sample with the filter, returning a new sample.
-
#process(sample : Float32) : Float32
Processes a single sample with the filter, returning a new sample.
-
#process(block : Array(Float64) | Slice(Float64)) : BiQuadFilter
"Runs" the filter over
block
. -
#process(block : Array(Float32) | Slice(Float32)) : BiQuadFilter
"Runs" the filter over
block
. -
#reset
Clears the internal buffer.
- #sampleRate=(val : Int | Float) : Nil
-
#setAllPass(centerFreq : Float64, bandwidth : Float64) : Nil
Puts the filter into allpass mode, setting the center frequency and the resonance ("Q" value).
-
#setBandPass(centerFreq : Float64, bandwidth : Float64) : Nil
Puts the filter into bandpass mode, setting the center frequency and the width of the filter in octaves.
-
#setHighPass(cutoff : Float64, resonance : Float64) : Nil
Puts the filter into highpass mode, setting the cutoff frequency and the resonance ("Q" value).
-
#setHighShelf(cutoff : Float64, gain : Float64, bandwidth : Float64) : Nil
Puts the filter into low shelf mode, setting the cutoff frequency and the resonance ("Q" value).
-
#setLowPass(cutoff : Float64, resonance : Float64) : Nil
Puts the filter into lowpass mode, setting the cutoff frequency and the resonance ("Q" value).
-
#setLowShelf(cutoff : Float64, gain : Float64, bandwidth : Float64) : Nil
Puts the filter into low shelf mode, setting the cutoff frequency and the resonance ("Q" value).
-
#setNotch(centerFreq : Float64, bandwidth : Float64) : Nil
Puts the filter into notch (bandstop) mode, setting the center frequency and the resonance ("Q" value).
-
#setPeakingEQ(centerFreq : Float64, gain : Float64, bandwidth : Float64) : Nil
Puts the filter into peaking EQ mode, setting the center frequency and the resonance ("Q" value).
-
#width : Float64
The current width of the filter.
Constructor Detail
Instance Method Detail
The current gain of the filter.
Setting the filter to be a lowpass, highpass, bandpass, notch, or allpass filter will cause this to always return 1.0. Otherwise this returns the actual gain.
Generates a string that can be passed to a program to plot this filter on
a graph. The PlotType
dictates what kind of script is generated.
Processes a single sample with the filter, returning a new sample.
Processes a single sample with the filter, returning a new sample.
"Runs" the filter over block
.
"Runs" the filter over block
.
Puts the filter into allpass mode, setting the center frequency and the resonance ("Q" value).
This deactivates the filter if cutoff is greater than the NyQuist limit, or bandwidth is <= 0.
Puts the filter into bandpass mode, setting the center frequency and the width of the filter in octaves.
This deactivates the filter if cutoff is greater than the NyQuist limit, or bandwidth is <= 0.
Puts the filter into highpass mode, setting the cutoff frequency and the resonance ("Q" value).
This deactivates the filter if cutoff is greater than the NyQuist limit.
If resonance
is less than or equal to 0, then resonance is set to
RESONANCE_MIN
.
Puts the filter into low shelf mode, setting the cutoff frequency and the resonance ("Q" value).
This deactivates the filter if cutoff is greater than the NyQuist limit, if gain is 0, or if bandwidth is <= 0.
Puts the filter into lowpass mode, setting the cutoff frequency and the
resonance ("Q" value). The resonance will be clamped to
RESONANCE_MIN..RESONANCE_MAX
.
This deactivates the filter if cutoff is greater than the NyQuist limit.
If resonance
is less than or equal to 0, then resonance is set to
RESONANCE_MIN
.
Puts the filter into low shelf mode, setting the cutoff frequency and the resonance ("Q" value).
This deactivates the filter if cutoff is greater than the NyQuist limit, if gain is 0, or if bandwidth is <= 0.
Puts the filter into notch (bandstop) mode, setting the center frequency and the resonance ("Q" value).
This deactivates the filter if cutoff is greater than the NyQuist limit, or bandwidth is <= 0.
Puts the filter into peaking EQ mode, setting the center frequency and the resonance ("Q" value).
This deactivates the filter if cutoff is greater than the NyQuist limit, if gain is 0, or if bandwidth is <= 0.
The current width of the filter. This may be the bandwidth, or the Q value, depending on the mode the filter is set to.