smallest

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: 14 Imported by: 0

Documentation

Overview

Package smallest is a streaming text-to-speech service backed by Smallest AI's Waves WebSocket. For each sentence it opens a connection, sends the transcript, and streams the raw PCM audio chunks downstream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSTT

func NewSTT(cfg STTConfig) *stt.StreamService

NewSTT builds a Smallest AI streaming STT service.

func NewTTS

func NewTTS(cfg Config) *tts.Base

NewTTS builds a Smallest AI TTS service.

Types

type Config

type Config struct {
	// APIKey is the Smallest AI API key. Required.
	APIKey string `validate:"required"`
	// URL overrides the TTS WebSocket endpoint; empty uses the hosted endpoint.
	URL string
	// Model is the Smallest model id; empty uses a default.
	Model string
	// Voice is the voice id; empty uses a default voice.
	Voice 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
	// Speed multiplies the speaking rate; nil uses the service default.
	Speed *float64
}

Config configures the Smallest AI TTS service.

func (Config) Validate

func (c Config) Validate() error

Validate reports whether the configuration is usable.

type STTConfig

type STTConfig struct {
	// APIKey is the Smallest AI API key. Required.
	APIKey string `validate:"required"`
	// BaseURL overrides the STT WebSocket base; empty uses the hosted endpoint.
	BaseURL string
	// Language is the audio language code; empty lets the service auto-detect.
	Language string
	// Encoding is the PCM encoding sent to the API; empty uses "linear16".
	Encoding string
	// SampleRate is the input audio sample rate; 0 uses the transport's rate.
	SampleRate int
}

STTConfig configures the Smallest AI streaming STT (Pulse) service.

func (STTConfig) Validate

func (c STTConfig) 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