fishaudio

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 16 Imported by: 1 module, 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 fishaudio adapts the self-hosted Fish Speech HTTP server to the stable OpenRealtime streaming speech interface.

Fish selects the base model when its server starts. The request therefore contains synthesis controls and optional voice references, but deliberately does not invent a per-request model field.

Index

Constants

View Source
const (
	// DefaultEndpoint is where tools/fish15 serves Fish Speech 1.5.
	DefaultEndpoint = "http://127.0.0.1:8123/v1/tts"
	// DefaultModel records the server-side checkpoint. The native request has
	// no model selector, so this only names what the endpoint is serving.
	DefaultModel = "fishaudio/fish-speech-1.5"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter is safe for concurrent calls. Fish server-side scheduling determines actual concurrency; each Stream call owns independent request state.

func New

func New(config Config) (*Adapter, error)

New validates and copies configuration.

func (*Adapter) Descriptor

func (adapter *Adapter) Descriptor() v1.Descriptor

Descriptor implements api/v1.SpeechProvider.

func (*Adapter) Stream

func (adapter *Adapter) Stream(ctx context.Context, plan v1.SpeechPlan, consume func(v1.SpeechChunk) error) error

Stream implements api/v1.StreamingSpeechProvider. It forwards output as 24 kHz PCM16LE by default, suitable for the existing OpenAI Realtime media boundary. Only the last sample is retained to mark the terminal chunk, so streaming adds less than one output-sample period of buffering.

func (*Adapter) Synthesize

func (adapter *Adapter) Synthesize(ctx context.Context, plan v1.SpeechPlan) ([]v1.SpeechChunk, error)

Synthesize collects Stream output for consumers that require the non-streaming stable interface. MaxAudioBytes bounds the retained result.

type Config

type Config struct {
	Endpoint             string
	Model                string
	BearerToken          string
	Headers              http.Header
	HTTPClient           *http.Client
	RequestTimeout       time.Duration
	ServerSampleRateHz   uint32
	OutputSampleRateHz   uint32
	ReferenceID          string
	References           []Reference
	UseMemoryCache       bool
	DisableNormalization bool
	Seed                 *int64
	ChunkLength          int
	MaxNewTokens         int
	TopP                 float64
	RepetitionPenalty    float64
	Temperature          float64
	ReadBufferBytes      int
	MaxAudioBytes        int64
}

Config configures a Fish Speech client. ServerSampleRateHz is used for the raw streaming contract employed by the official client; if a server emits a WAV header, its declared rate is validated and used instead.

type Reference

type Reference struct {
	Audio []byte `json:"audio"`
	Text  string `json:"text"`
}

Reference supplies an in-context voice example. Audio contains an encoded audio file (for example WAV), not raw PCM. ReferenceID takes precedence when both forms are configured, matching Fish Speech's native behavior.

Jump to

Keyboard shortcuts

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