Documentation
¶
Index ¶
- type Biquad
- func (bq *Biquad) Configure(p *BiquadParams)
- func (bq *Biquad) Magnitude(freq float64) float64
- func (bq *Biquad) Magnitudes(freqs []float64) []float64
- func (bq *Biquad) PlotMagnitude(freqs []float64) (*plot.Plot, error)
- func (bq *Biquad) PlotMagnitudeDecibel(freqs []float64) (*plot.Plot, error)
- func (bq *Biquad) ProcessSample(in float64) float64
- func (bq *Biquad) SampleRate() float64
- type BiquadParams
- type BiquadState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Biquad ¶
type Biquad struct {
// contains filtered or unexported fields
}
func (*Biquad) Configure ¶
func (bq *Biquad) Configure(p *BiquadParams)
func (*Biquad) Magnitude ¶
Magnitude calculates the magnitude response for the given frequency. Method for determining freq magnitude response is from: http://rs-met.com/documents/dsp/BasicDigitalFilters.pdf
func (*Biquad) Magnitudes ¶
Magnitudes calculates the magnitude responses for the given frequencies. Method for determining freq magnitude response is from: http://rs-met.com/documents/dsp/BasicDigitalFilters.pdf
func (*Biquad) PlotMagnitude ¶
PlotMagnitude produces a plot with magnitude response for the given freqs.
func (*Biquad) PlotMagnitudeDecibel ¶
PlotMagnitudeDecibel produces a plot with magnitude response (in dB) for the given freqs.
func (*Biquad) ProcessSample ¶
ProcessSample calculates biquad output using Direct Form I:
y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2]
- (a1/a0)*y[n-1] - (a2/a0)*y[n-2]
Note: coefficients are already divided by a0 when they are calculated. So that step is left out during processing.
func (*Biquad) SampleRate ¶
type BiquadParams ¶
type BiquadParams struct {
B0, B1, B2, A0, A1, A2 float64
}
type BiquadState ¶
type BiquadState struct {
X1, X2, Y1, Y2 float64
}