fir

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FIR

type FIR struct {
	// contains filtered or unexported fields
}

FIR (Finite Impulse Response) filter

func NewFIR

func NewFIR(kernel []float64) *FIR

NewFIR makes a new FIR filter.

func (*FIR) Convolve

func (fir *FIR) Convolve(input []float64) ([]float64, error)

Convolve the given input data with the filter kernel. Returns non-nil error if input size not be greater than the filter kernel size.

func (*FIR) FreqResponse

func (fir *FIR) FreqResponse(srate float64) *freqresponse.FreqResponse

FreqResponse calculates the filter frequency response.

func (*FIR) Order

func (fir *FIR) Order() int

Order is the FIR order

type SincFilter

type SincFilter struct {
	// contains filtered or unexported fields
}

SincFilter is windowed FIR filter that implements lowpass and highpass. A bandpass and bandstop filter would be implemented using two of these. Theoretical source: http://www.labbookpages.co.uk/audio/firWindowing.html

func NewSincFilter

func NewSincFilter(srate, cutoff float64, order int, w window.WindowMaker) (*SincFilter, error)

NewSincFilter makes a new FIR filter that can be used for highpass and lowpass filtering.

func (*SincFilter) Highpass

func (f *SincFilter) Highpass(input []float64) ([]float64, error)

Highpass processes the input with the highpass FIR.

func (*SincFilter) HighpassResponse

func (f *SincFilter) HighpassResponse() *freqresponse.FreqResponse

HighpassResponse returns the frequency response of the highpass FIR.

func (*SincFilter) Lowpass

func (f *SincFilter) Lowpass(input []float64) ([]float64, error)

Lowpass processes the input with the lowpass FIR.

func (*SincFilter) LowpassResponse

func (f *SincFilter) LowpassResponse() *freqresponse.FreqResponse

LowpassResponse returns the frequency response of the lowpass FIR.

func (*SincFilter) SampleRate

func (f *SincFilter) SampleRate() float64

SampleRate returns the sample rate that the filter was designed with.

Jump to

Keyboard shortcuts

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