vocoder

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2014 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package vocoder provides support for vocoding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B2MC

func B2MC(b []float64, alpha float64) []float64

B2MC performs conversion from MLSA filter coefficients to Mel-cepstrum.

func MC2B

func MC2B(mcep []float64, alpha float64) []float64

Alias to SPTK will be removed

func MCep2MLSAFilterCoef

func MCep2MLSAFilterCoef(mcep []float64, alpha float64) []float64

MCep2MLSAFilterCoef performs a conversion from mel-cepstrum to MLSA filter coefficients given mel-cepstrum and all-pass constant(alpha).

func MGCep2MGLSAFilterCoef

func MGCep2MGLSAFilterCoef(melgcep []float64, alpha, gamma float64) []float64

MGCep2MGLSAFilterCoef performs a conversion from mel-generalized cepstrum to MGLSA filter coefficients.

Types

type MGLSABaseFilter

type MGLSABaseFilter struct {
	Order int // Order of mel-cepstrum
	// all-pass constant (alpha) that determines how frequency axis is warped.
	Alpha float64
	// contains filtered or unexported fields
}

MGLSABaseFilter represents a base filter of MGLSAFilter.

func NewMGLSABaseFilter

func NewMGLSABaseFilter(order int, alpha float64) *MGLSABaseFilter

func (*MGLSABaseFilter) Filter

func (bf *MGLSABaseFilter) Filter(sample float64, filterCoef []float64) float64

type MGLSAFilter

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

MGLSAFilter represents a Mel-generalized log-spectral approximation filter.

func NewMGLSAFilter

func NewMGLSAFilter(order int, alpha float64, numStage int) *MGLSAFilter

func (*MGLSAFilter) Filter

func (mf *MGLSAFilter) Filter(sample float64, filterCoef []float64) float64

type MGLSASpeechSynthesizer

type MGLSASpeechSynthesizer struct {
	FrameShift int
	Alpha      float64 // all-pass constant
	Gamma      float64 // parameter of generalized logarithmic function
	NumStage   int
	// contains filtered or unexported fields
}

MGLSASpeechSynthesizer represents a speech synthesizer based on the MGLSA Filter.

func NewMGLSASpeechSynthesizer

func NewMGLSASpeechSynthesizer(order int, alpha float64, numStage int,
	frameShift int) *MGLSASpeechSynthesizer

NewMGLSASpeechSynthesizer returns its instance given parameters.

func (*MGLSASpeechSynthesizer) Synthesis

func (s *MGLSASpeechSynthesizer) Synthesis(excite []float64,
	mgcepSequence [][]float64) []float64

Synthesis synthesizes a speech signal from an excitation signal and corresponding mel-ceptrum sequence.

func (*MGLSASpeechSynthesizer) SynthesisOneFrame

func (s *MGLSASpeechSynthesizer) SynthesisOneFrame(excite []float64,
	previousMgcep, currentMgcep []float64) []float64

SynthesisOneFrame synthesizes a part of speech signal from an excitation signal and succesive two mel-cepstrum sequence. It requires all-pass constant (alpha). Mel-cepstral coefficients between two succesive mel-cepstrum are linearly interpolated.

type MLSABaseFilter

type MLSABaseFilter struct {
	Order int // Order of mel-cepstrum
	// all-pass constant (alpha) that determines how frequency axis is warped.
	Alpha float64
	// contains filtered or unexported fields
}

MLSABaseFilter represents a base filter of the MLSA digital filter.

func NewMLSABaseFilter

func NewMLSABaseFilter(order int, alpha float64) *MLSABaseFilter

NewMLSABaseFilter returns its instance. It requires the order of mel-cepstrum and all-pass constant (alpha).

func (*MLSABaseFilter) Filter

func (bf *MLSABaseFilter) Filter(sample float64, filterCoef []float64) float64

Filter returns filtered sample given the inpuy sample and filter coeffficients.

type MLSACascadeFilter

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

MLSACascadeFilter represents a cascade filter which contains MLSA base filters.

func NewMLSACascadeFilter

func NewMLSACascadeFilter(order int, alpha float64, orderOfPade int) *MLSACascadeFilter

NewMLSABaseFilter returns its instance and error with the order of mel-cepstrum, all-pass constant (alpha) and the order of pade approximation. Order of pade approximation 4 or 5 is only supported. If other one is specified, it returns non-nil error.

func (*MLSACascadeFilter) Filter

func (cf *MLSACascadeFilter) Filter(sample float64, filterCoef []float64) float64

Filter returns filtered sample given the inpuy sample and filter coeffficients.

type MLSAFilter

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

MLSAFilter represents a Mel-Log Spectrum Approximation (MLSA) filter, which is composed of two cascade filters.

func NewMLSAFilter

func NewMLSAFilter(order int, alpha float64, orderOfPade int) *MLSAFilter

NewMLSAFilter returns its instance and error. It requires the order of mel-cepstrum, all-pass constant (alpha) and the order of pade approximation.

func (*MLSAFilter) Filter

func (f *MLSAFilter) Filter(sample float64, filterCoef []float64) float64

Filter returns filtered sample given the input and MLSA filter coefficients. The MLSA filter is composed of two stage cascade filter.

type MLSASpeechSynthesizer

type MLSASpeechSynthesizer struct {
	CoreFilter *MLSAFilter // used in sample by sample speech generation
	FrameShift int
	Alpha      float64 // all-pass constant
}

MLSASpeechSynthesizer represents a speech synthesizer based on MLSA Filter.

func NewMLSASpeechSynthesizer

func NewMLSASpeechSynthesizer(numMceps int, alpha float64, orderOfPade int,
	frameShift int) *MLSASpeechSynthesizer

NewMLSASpeechSynthesizer returns its instance given parameters.

func (*MLSASpeechSynthesizer) Synthesis

func (s *MLSASpeechSynthesizer) Synthesis(excite []float64,
	mcepSequence [][]float64) []float64

Synthesis synthesizes a speech signal from an excitation signal and corresponding mel-ceptrum sequence.

func (*MLSASpeechSynthesizer) SynthesisOneFrame

func (s *MLSASpeechSynthesizer) SynthesisOneFrame(excite []float64,
	previousMcep, currentMcep []float64) []float64

SynthesisOneFrame synthesizes a part of speech signal from an excitation signal and succesive two mel-cepstrum sequence. It requires all-pass constant (alpha). Mel-cepstral coefficients between two succesive mel-cepstrum are linearly interpolated.

Jump to

Keyboard shortcuts

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