analysis

package
v0.0.0-...-c5379f9 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FFTShiftF

func FFTShiftF(buffer []float64) []float64

FFTShiftF shifts a buffer of floats. The passed buffer is modified. See http://www.mathworks.com/help/matlab/ref/fftshift.html

func MinMaxFloat

func MinMaxFloat(buf *audio.PCMBuffer) (min, max float64)

MinMaxFloat returns the smallest and biggest samples in the buffer

func TotalEnergy

func TotalEnergy(buf *audio.PCMBuffer) float64

TotalEnergy is the the sum of squared moduli See https://www.dsprelated.com/freebooks/mdft/Signal_Metrics.html

Types

type DFT

type DFT struct {
	// in audio, we only get real numbers
	// Coefs are the amount of signal energy at those frequency,
	// the amplitude is relative but can be compared as absolute values
	// between buffers.
	Coefs      []complex128
	SampleRate int
	// contains filtered or unexported fields
}

DFT is the Discrete Fourier Transform representation of a signal https://en.wikipedia.org/wiki/Discrete_Fourier_transform

func NewDFT

func NewDFT(sr int, x []float64) *DFT

NewDFT returns the FFT result wrapped in a DFT struct

func (*DFT) BinWidth

func (d *DFT) BinWidth() int

BinWidth is the width of a bin (in frequency). It is calculate by using the Nyquist frequency (sample rate/2) divided by the DFT size.

func (*DFT) IFFT

func (d *DFT) IFFT() []float64

IFFT runs an inverse fast fourrier transform and returns the float values

func (*DFT) ToFreqRange

func (d *DFT) ToFreqRange() map[int]float64

ToFreqRange returns a map with the frequency and their values (normalized)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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