Documentation
¶
Index ¶
- func CheckTTSLoadError() (error, bool)
- func PreloadTTSModel(lg *log.Logger, targetSampleRate int)
- func SynthesizeContactTTS(text, voice string, radioSeed uint32) ([]int16, error)
- func SynthesizeReadbackTTS(text, voice string, radioSeed uint32) ([]int16, error)
- type Config
- type GeneratedAudio
- type OfflineTts
- type SharedWeights
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTTSLoadError ¶
CheckTTSLoadError returns any TTS loading error if loading has completed. Returns (nil, false) if loading is still in progress. Returns (err, true) if loading completed (err may be nil if successful). This is safe to call from the main thread for UI error display.
func PreloadTTSModel ¶
func SynthesizeContactTTS ¶
SynthesizeContactTTS generates PCM audio for a contact using the low-priority TTS instance. The radioSeed determines per-aircraft radio characteristics so the same aircraft has a consistent sound.
func SynthesizeReadbackTTS ¶
SynthesizeReadbackTTS generates PCM audio for a readback using the high-priority TTS instance. The radioSeed determines per-aircraft radio characteristics so the same aircraft has a consistent sound.
Types ¶
type Config ¶
type Config struct {
ModelPath string
VoicesPath string
TokensPath string
DataDir string
DictDir string
LexiconPath string
Lang string
NumThreads int
LowPriority bool
MaxSentences int
}
Config holds TTS configuration parameters.
type GeneratedAudio ¶
GeneratedAudio holds synthesized audio data.
type OfflineTts ¶
type OfflineTts struct {
// contains filtered or unexported fields
}
OfflineTts wraps a sherpa-onnx offline TTS instance.
func NewOfflineTts ¶
func NewOfflineTts(config Config, shared *SharedWeights) *OfflineTts
NewOfflineTts creates a TTS instance. If shared is non-nil, model weights are shared with other instances using the same SharedWeights.
func (*OfflineTts) Generate ¶
func (t *OfflineTts) Generate(text string, voiceID int, speed float32) *GeneratedAudio
Generate synthesizes speech from text.
type SharedWeights ¶
type SharedWeights struct {
// contains filtered or unexported fields
}
SharedWeights holds model data loaded once for sharing between TTS instances.
func NewSharedWeights ¶
func NewSharedWeights(modelPath, voicesPath string) *SharedWeights
NewSharedWeights loads model.onnx and voices.bin into memory for sharing.