ttsstream

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: BSD-2-Clause Imports: 7 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 ttsstream holds the loops the HTTP text-to-speech providers share: reading a raw PCM response body in chunks and turning the chunks into audio frames.

The loops wait only through the client they are given. A provider called on the session's loop hands them a client from awaitio.Client, so the request and each read of its body let go of the loop, and each chunk is handled on it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PCMYielder

func PCMYielder(yield func(f frames.Frame) error, rate int) func(pcm []byte) error

PCMYielder adapts a frame yield to a callback taking raw 16-bit mono PCM, for a provider whose output is audio and nothing else.

func Response

func Response(client *http.Client, req *http.Request, emit func(pcm []byte) error) error

Response issues req and streams the raw-PCM response body to emit in chunks. It is the shared body-reading loop for HTTP TTS providers. Pair it with PCMYielder to turn the chunks into frames.

func Speech

func Speech(client *http.Client, req *http.Request, text string, emit func(pcm []byte) error) error

Speech is Response for a request synthesizing text: once the provider accepts the request, text is reported as usage (see tts.StartUsageMetrics), through the context req was built with.

Types

This section is empty.

Jump to

Keyboard shortcuts

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