piper

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package piper is a text-to-speech provider for a local Piper HTTP server (python -m piper.http_server). The server accepts the text to speak as the request body and returns a WAV file; this provider strips the WAV header and streams the raw PCM samples downstream.

Piper's sample rate depends on the voice the server was launched with (16 kHz for "low" voices, 22.05 kHz for "medium"). Set SampleRate to match the voice; the pipeline resamples to the output rate from there.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTTS

func NewTTS(cfg Config) *tts.Base

NewTTS builds a Piper TTS service.

Types

type Config

type Config struct {
	// BaseURL is the Piper HTTP server's synthesis endpoint (e.g.
	// http://localhost:5000). The text to speak is POSTed as the body. Required.
	BaseURL string `validate:"required,url"`
	// SampleRate is the PCM rate of the configured Piper voice; 0 uses 22050.
	SampleRate int
}

Config configures the Piper TTS provider.

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