asyncai

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package asyncai is a streaming text-to-speech service backed by Async's TTS WebSocket. For each sentence it opens a connection, sends an init message and the transcript, and streams the raw PCM audio chunks downstream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTTS

func NewTTS(cfg Config) *tts.Base

NewTTS builds an Async TTS service.

Types

type Config

type Config struct {
	// APIKey is the Async API key. Required.
	APIKey string `validate:"required"`
	// Voice is the voice id (UUID) to synthesize with. Required.
	Voice string `validate:"required"`
	// URL overrides the TTS WebSocket endpoint; empty uses the hosted endpoint.
	URL string
	// Version sets the API version; empty uses a default.
	Version string
	// Model is the Async model id; empty uses a default.
	Model string
	// Language is the synthesis language code; empty uses "en".
	Language string
	// SampleRate is the PCM rate requested and emitted downstream; 0 uses 24 kHz.
	SampleRate int
}

Config configures the Async TTS service.

func (Config) Validate

func (c Config) Validate() error

Validate reports whether the configuration is usable.

Jump to

Keyboard shortcuts

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