espeak

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Quality settings
	Quick     = 0 // Quick cubic interpolation
	LowQ      = 1 // LowQ 16-bit with larger rolloff
	MediumQ   = 2 // MediumQ 16-bit with medium rolloff
	HighQ     = 4 // High quality
	VeryHighQ = 6 // Very high quality

	// Input formats
	F32 = 0 // 32-bit floating point PCM
	F64 = 1 // 64-bit floating point PCM
	I32 = 2 // 32-bit signed linear PCM
	I16 = 3 // 16-bit signed linear PCM

)

Variables

This section is empty.

Functions

func AddWavHeader

func AddWavHeader(pcm []byte, sampleRate int, channels int, bitsPerSample int) (wav []byte, err error)

func Cancel

func Cancel() int

func GetDefaultParameter

func GetDefaultParameter(parameter EspeakParameter) int

func GetParameter

func GetParameter(parameter EspeakParameter) int

func Initialize

func Initialize(ngDataPath string) int

func IsPlaying

func IsPlaying() int

func Save

func Save(textInput, wavOutput string) int

func SetParameter

func SetParameter(parameter EspeakParameter, value int, relative int) int

func SetVoiceByName

func SetVoiceByName(voice string) int

func Sync

func Sync() int

func Synth

func Synth(text string, position uint, positionType EspeakPositionType, endPosition uint) int

func SynthFlags

func SynthFlags(text string, position uint, positionType EspeakPositionType, endPosition uint, flags EspeakSynthFlag) int

func Terminate

func Terminate() int

Types

type EspeakAudioOutput

type EspeakAudioOutput int
const (
	AUDIO_OUTPUT_PLAYBACK       EspeakAudioOutput = 0
	AUDIO_OUTPUT_RETRIEVAL      EspeakAudioOutput = 1
	AUDIO_OUTPUT_SYNCHRONOUS    EspeakAudioOutput = 2
	AUDIO_OUTPUT_SYNCH_PLAYBACK EspeakAudioOutput = 3
)

type EspeakParameter

type EspeakParameter int
const (
	SILENCE     EspeakParameter = 0
	RATE        EspeakParameter = 1
	VOLUME      EspeakParameter = 2
	PITCH       EspeakParameter = 3
	RANGE       EspeakParameter = 4
	PUNCTUATION EspeakParameter = 5
	CAPITALS    EspeakParameter = 6
	WORDGAP     EspeakParameter = 7
	OPTIONS     EspeakParameter = 8
	INTONATION  EspeakParameter = 9

	RESERVED1      EspeakParameter = 10
	RESERVED2      EspeakParameter = 11
	EMPHASIS       EspeakParameter = 12
	LINELENGTH     EspeakParameter = 13
	VOICETYPE      EspeakParameter = 14
	N_SPEECH_PARAM EspeakParameter = 15
)

type EspeakPositionType

type EspeakPositionType int
const (
	POS_CHARACTER EspeakPositionType = 1
	POS_WORD      EspeakPositionType = 2
	POS_SENTENCE  EspeakPositionType = 3
)

type EspeakSynthFlag

type EspeakSynthFlag int
const (
	FLAG_SSML          EspeakSynthFlag = 0x10
	FLAG_PHONEMES      EspeakSynthFlag = 0x100
	FLAG_ENDPAUSE      EspeakSynthFlag = 0x1000
	FLAG_KEEP_NAMEDATA EspeakSynthFlag = 0x2000
)

type Resampler

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

Resampler resamples PCM sound data.

func NewResampler

func NewResampler(writer io.Writer, inputRate, outputRate float64, channels, format, quality int) (*Resampler, error)

NewResampler returns a pointer to a Resampler that implements an io.WriteCloser. It takes as parameters the destination data Writer, the input and output sampling rates, the number of channels of the input data, the input format and the quality setting.

func (*Resampler) Close

func (r *Resampler) Close() (err error)

Close clean-ups and frees memory. Should always be called when finished using the resampler.

func (*Resampler) Reset

func (r *Resampler) Reset(writer io.Writer) (err error)

Reset permits reusing a Resampler rather than allocating a new one.

func (*Resampler) Write

func (r *Resampler) Write(p []byte) (i int, err error)

Write resamples PCM sound data. Writes len(p) bytes from p to the underlying data stream, returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early.

Jump to

Keyboard shortcuts

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