reducer

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DenormalizeIntoInt added in v1.0.1

func DenormalizeIntoInt(signal []float64) []int

func NormalizeIntoFloat added in v1.0.1

func NormalizeIntoFloat(signal []int) []float64

Types

type NoiseSubstractionMethod

type NoiseSubstractionMethod int
const (
	SpectralSubtractMethod NoiseSubstractionMethod = 0
	AdaptiveMethod         NoiseSubstractionMethod = 1
	NoiseGateMethod        NoiseSubstractionMethod = 2
)

type Reducer

type Reducer struct {
	OverSubtractFactor float64 // Power of noise subtraction in spectral subtraction method
	LowFreqFacrtor     float64 // Frequency factors in adaptive subtraction method
	HighFreqFacrtor    float64
	ThresholdDb        float64 // Threshold decibels in noise gate subtraction method
	// contains filtered or unexported fields
}

func NewReducer

func NewReducer(chuckSize, hopLength int, method NoiseSubstractionMethod) *Reducer

func (*Reducer) NewNoiseSample

func (r *Reducer) NewNoiseSample(noiseSample []float64)

NewNoiseSample method params:

noiseSample []float64 - Slice with PCM audio data

Use this func to set noise sample, reduction on an audio fragment, that is, a section of audio containing only noise.

If such a section is unknown in advance, the first X samples of the recording are usually used as noise sample, for example, 10000 bytes of audio.

func (*Reducer) Reduce

func (r *Reducer) Reduce(audio []float64) ([]float64, error)

Reduce method params:

audio []float64 - Slice with PCM audio data

Use this func to perform noise reduction on an audio fragment.

Jump to

Keyboard shortcuts

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