filter

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package filter designs and applies finite impulse response filters. Sinc calculates windowed low-pass and high-pass coefficients, and FIR applies them to a sample slice.

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 window.GeneratorFunc // Window function to apply.
	// 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