iir

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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 NewBiquad

func NewBiquad(srate float64) (*Biquad, error)

func (*Biquad) Configure

func (bq *Biquad) Configure(p *BiquadParams)

func (*Biquad) Magnitude

func (bq *Biquad) Magnitude(freq float64) float64

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

func (bq *Biquad) Magnitudes(freqs []float64) []float64

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

func (bq *Biquad) PlotMagnitude(freqs []float64) (*plot.Plot, error)

PlotMagnitude produces a plot with magnitude response for the given freqs.

func (*Biquad) PlotMagnitudeDecibel

func (bq *Biquad) PlotMagnitudeDecibel(freqs []float64) (*plot.Plot, error)

PlotMagnitudeDecibel produces a plot with magnitude response (in dB) for the given freqs.

func (*Biquad) ProcessSample

func (bq *Biquad) ProcessSample(in float64) float64

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

func (bq *Biquad) SampleRate() float64

type BiquadParams

type BiquadParams struct {
	B0, B1, B2, A0, A1, A2 float64
}

type BiquadState

type BiquadState struct {
	X1, X2, Y1, Y2 float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL