filter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 2 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 {
	Sinc *Sinc
}

FIR represents a Finite Impulse Response filter taking a sinc. https://en.wikipedia.org/wiki/Finite_impulse_response

func (*FIR) Convolve

func (f *FIR) Convolve(dst, src, kernels []float64) []float64

Convolve "mixes" two signals together kernels is the imput that is not part of our signal, it might be shorter than the origin signal.

func (*FIR) HighPass

func (f *FIR) HighPass(dst, src []float64) []float64

func (*FIR) LowPass

func (f *FIR) LowPass(dst, src []float64) []float64

LowPass applies a low pass filter using the FIR

type Sinc

type Sinc struct {
	CutOffFrequency float64

	SampleRate int

	// Taps are the numbers of samples we go back in time when processing the sync function.
	// The tap numbers will affect the shape of the filter. The more taps, the more
	// shape but the more delays being injected.
	Taps int

	// Window function to apply.
	Window window.GeneratorFunc
	// contains filtered or unexported fields
}

Sinc represents a sinc function The sinc function also called the "sampling function," is a function that arises frequently in signal processing and the theory of Fourier transforms. The full name of the function is "sine cardinal," but it is commonly referred to by its abbreviation, "sinc." http://mathworld.wolfram.com/SincFunction.html

func (*Sinc) HighPassCoefficients

func (s *Sinc) HighPassCoefficients() []float64

HighPassCoefficients returns the coeficients to create a high pass filter

func (*Sinc) LowPassCoefficients

func (s *Sinc) LowPassCoefficients() []float64

LowPassCoefficients returns the coeficients to create a low pass filter

func (*Sinc) TransitionFrequency

func (s *Sinc) TransitionFrequency() float64

TransitionFrequency returns a ratio of the cutoff frequency and the sample rate.

Jump to

Keyboard shortcuts

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