engine

package module
v0.0.0-...-18b40f7 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioChunk

type AudioChunk struct {
	Data  []float32
	Index int
	// SampleRate of the audio in Hz (ex: 48kHz = 48000)
	SampleRate int
	// ChannelCount of the audio (usually 1)
	ChannelCount int
}

type Engine

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

func New

func New(params EngineParams) (*Engine, error)

func (*Engine) Generate

func (e *Engine) Generate(text string) error

Generate will chunk the text into sections and call the synthesize function on the Synthesizer for each segment. It will call onAudioChunk for each returned chunk from the synthesizer

func (*Engine) OnAudioChunk

func (e *Engine) OnAudioChunk(fn func(AudioChunk))

type EngineParams

type EngineParams struct {
	OnAudioChunk func(AudioChunk)
	Synthesizer  Synthesizer
}

type Synthesizer

type Synthesizer interface {
	Synthesize(text string) (AudioChunk, error)
}

Jump to

Keyboard shortcuts

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