mel

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFileNotLoaded = errors.New("wavNotLoaded")

Functions

func ISTFT added in v0.0.3

func ISTFT(s *stft.STFT, spectrogram [][]complex128, numIterations int) []float64

func LoadFlac added in v0.0.2

func LoadFlac(inputFile string) []float64

LoadFlac loads mono flac file to sample vector

func LoadWav added in v0.0.2

func LoadWav(inputFile string) []float64

LoadWav loads mono wav file to sample vector

func SaveWav added in v0.0.3

func SaveWav(outputFile string, vec []float64, sr int) error

SaveWav saves mono wav file from sample vector

Types

type Mel

type Mel struct {
	NumMels  int
	MelFmin  float64
	MelFmax  float64
	TuneMul  float64
	TuneAdd  float64
	Window   int
	Resolut  int
	YReverse bool

	GriffinLimIterations int

	// VolumeBoost when loading spectrogram from image, can be a value like 1.666
	VolumeBoost float64

	// sample rate for output wav
	SampleRate int
}

Mel represents the configuration for generating mel spectrograms.

func NewMel

func NewMel() *Mel

NewMel creates a new Mel instance with default values.

func (*Mel) FromMel added in v0.0.3

func (m *Mel) FromMel(ospectrum [][2]float64) ([]float64, error)

FromMel generates a wave buffer from a mel spectrogram and returns the wave buffer.

func (*Mel) Image added in v0.0.2

func (m *Mel) Image(buf [][2]float64) []uint16

func (*Mel) ToMel

func (m *Mel) ToMel(buf []float64) ([][2]float64, error)

ToMel generates a mel spectrogram from a wave buffer and returns the mel buffer.

func (*Mel) ToMelFlac

func (m *Mel) ToMelFlac(inputFile, outputFile string) error

ToMel generates a mel spectrogram from an input FLAC audio file and saves it as a PNG image.

func (*Mel) ToMelWav

func (m *Mel) ToMelWav(inputFile, outputFile string) error

ToMel generates a mel spectrogram from an input WAV audio file and saves it as a PNG image.

func (*Mel) ToWavPng added in v0.0.3

func (m *Mel) ToWavPng(inputFile, outputFile string) error

Jump to

Keyboard shortcuts

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