ttsclient

package
v0.209.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ttsclient renders speech through an OpenAI-compatible `POST /v1/audio/speech` server (VoiceStudio, an OpenAI-shaped proxy, any engine that speaks that contract) and writes the encoded audio to a file.

It is the harness's `tts_endpoint` lane: the HTTP twin of the in-process Chatterbox worker, for boxes where the voice engine is a running server rather than a python script. The server owns its own GPU, so this lane takes no media lease — the same rule as any remote engine.

Index

Constants

View Source
const DefaultModel = "tts-1"

DefaultModel is what an OpenAI-compatible server accepts when the box configures no tts_model: every such server maps the OpenAI alias `tts-1` to its default engine (VoiceStudio 0.5.1 measured 2026-09-07: `tts-1` → 200, `default` → 400).

View Source
const DefaultVoice = "default"

DefaultVoice is the server's own default voice.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Base     string // server base URL, no trailing /v1 (e.g. http://127.0.0.1:3900)
	APIKey   string // optional bearer token
	Model    string // "" → DefaultModel
	Voice    string // "" → DefaultVoice
	Text     string // required
	Language string // optional ISO 639-1 hint (VoiceStudio extra; ignored by servers that do not know it)
	Format   string // "" → "wav"
	Out      string // output file path; parent dir is created
	Timeout  time.Duration
	Client   *http.Client // nil → a client with Timeout
}

Request is one render.

type Result

type Result struct {
	Path        string
	Bytes       int64
	ContentType string
	Model       string
	Voice       string
}

Result is what a successful render reports.

func Speak

func Speak(ctx context.Context, req Request) (Result, error)

Speak POSTs the render and writes the body to req.Out. An HTTP error, a non-audio body, or a too-small body is an error naming the server's own words — never a silent empty file.

Jump to

Keyboard shortcuts

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