foxConvolver

package
v0.0.0-...-3182ee9 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package: github.com/Foxenfurter/foxAudioLib/foxConvolver filename foxConvolver.go Package is designed to manage convolution of Filter Impulse Responses includes any logic neeeded to prepare the filter for convolution, such as Resampling and Normalization

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateFFT

func CalculateFFT(input []complex128) []complex128

func CalculateInverseFFT

func CalculateInverseFFT(input []complex128) []complex128

const FilterLength = 4000

func CalculateMaxGain

func CalculateMaxGain(audioData []float64) float64

Calculates the Maximum Gain Value - used for Normalization functions

func ConvolveImpulseOverlapSave

func ConvolveImpulseOverlapSave(impulse, signalBlock []float64, savedOverlap []complex128) ([]float64, []complex128)

func ConvolveImpulsesFFT

func ConvolveImpulsesFFT(impulse, signal []float64) []float64

use convolver directly without precomputed Impulse values and then convolve signal the impulse is the filter that you want to apply and the signal is what you want to apply it to - and output the original signal length will be kept

func ConvolveImpulsesSlow

func ConvolveImpulsesSlow(impulse1 []float64, impulse2 []float64) []float64

Simple convolver multiplication calculation for baseline testing

func InverseTukeyFFT

func InverseTukeyFFT(X []complex128) []complex128

simple Cooley-Tukey based inverse FFT for baseline benchmark

func Normalize

func Normalize(inputSamples [][]float64, targetLevel float64) float64

Normalizes Audio Data in supplied samples

func NormalizeAudioImpulseTrue

func NormalizeAudioImpulseTrue(audioImpulse []float64, targetLevel float64) []float64

Normalises and audio signal to the target level and calculate a max level. Max Level is therefore only for the current channel

func ReadnResampleFirFile

func ReadnResampleFirFile(filePath string, targetSampleRate int) (*bytes.Reader, error)

func TargetGain

func TargetGain(fromSampleRate, toSampleRate int) float64

Calculate the target gain level based on the sampling frequency parameters: Sample Rate (int) returns the target gain level as float64

func TukeyFFT

func TukeyFFT(X []complex128) []complex128

simple Cooley-Tukey based FFT for baseline benchmark

Types

type Convolver

type Convolver struct {
	Impulse         []float64    // Impulse response
	ImpulseLength   int          // Length of the impulse response
	WindowedImpulse []float64    // Windowed impulse response
	OverlapFactor   float64      // Overlap factor
	OverlapLength   int          // Length of overlap
	HopSize         int          // Hop size
	OverlapTail     []complex128 // Overlap tail
	DebugFunc       func(string)
	WarningFunc     func(string)
}

Convolver represents a convolver structure

func NewConvolver

func NewConvolver(impulse []float64, overlapFactor float64) Convolver

Init initializes the convolver structure supply FIR filter impulse and overlap factor as a value between 0.1 and 0.9

func (*Convolver) ConvolveImpulsesFFT

func (myConvolver *Convolver) ConvolveImpulsesFFT(signal []float64) []float64

use convolver structure with precomputed Impulse values and then convolve signal

func (*Convolver) Resample

func (myConvolver *Convolver) Resample(inputSamples [][]float64, fromSampleRate, toSampleRate, quality int) error

resample all input samples from fromSampleRate toSampleRate

Jump to

Keyboard shortcuts

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