dsp

package
v0.0.0-...-02edade Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispose

func Dispose()

func FFT

func FFT(
	samples []float64,
	freqArrayWidth int,
	n_bin int,
	windowFn func([]float64) []float64,
	isDFT bool,
) (freqArray []float64)

func FloatSampleToByteArray

func FloatSampleToByteArray(inB [][2]float64, outB []byte)

func Freq2NBin

func Freq2NBin(freq float64, sampleRate, n_bin int) int

Freq -> FFT N Bin

func LTTB

func LTTB(ctx context.Context, x []float64, y []float64, threshold int) ([]float64, []float64, error)

LTTB down-samples the data to contain only threshold number of points that have the same visual shape as the original data

func LTTB_Buffer

func LTTB_Buffer(ctx context.Context, x, y, outx, outy []float64, threshold int) ([]float64, []float64, error)

LTTB down-samples the data to contain only threshold number of points that have the same visual shape as the original data (With Output Buffer)

func Mel

func Mel(freq float64) float64

func MonoToStereo

func MonoToStereo(in []float64) [][2]float64

func NBin2Freq

func NBin2Freq(i, sampleRate, n_bin int) float64

FFT N Bin -> Freq

func ParallelFFT

func ParallelFFT(
	ctx context.Context,
	samples []float64,
	sampleRate int,
	freqArrayWidth int,
	n_bin int,
	windowFn func([]float64) []float64,
	isDFT bool,
) (freqArray []float64)

func StereoToMono

func StereoToMono(in [][2]float64) []float64

Types

type Spectrogram

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

func NewSpectrogram

func NewSpectrogram() *Spectrogram

func (*Spectrogram) Coefficients

func (st *Spectrogram) Coefficients(ctx context.Context, freqArrayWidth int) ([]float64, int, int)

func (*Spectrogram) Coefficients_NonBlock

func (st *Spectrogram) Coefficients_NonBlock(ctx context.Context, freqArrayWidth int) ([]float64, int, int)

func (*Spectrogram) NumBin

func (st *Spectrogram) NumBin() int

func (*Spectrogram) ResetFFTData

func (st *Spectrogram) ResetFFTData()

func (*Spectrogram) ResetSampleData

func (st *Spectrogram) ResetSampleData()

func (*Spectrogram) SetNumBin

func (st *Spectrogram) SetNumBin(n_bin int)

func (*Spectrogram) SetSampleData

func (st *Spectrogram) SetSampleData(sampleArray []float64, sampleRate int)

func (*Spectrogram) SetWindowFunc

func (st *Spectrogram) SetWindowFunc(windowFn func([]float64) []float64)

Jump to

Keyboard shortcuts

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