openaiaudio

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package openaiaudio contains OpenAI-backed audio helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeOggOpus

func DecodeOggOpus(r io.Reader, onFrame func([]byte) error) error

DecodeOggOpus reads an Ogg stream and emits each Opus packet payload.

func NormalizeAudioURL

func NormalizeAudioURL(apiBase, suffix string) string

NormalizeAudioURL appends an OpenAI audio endpoint suffix to an API base URL.

Types

type TTSClient

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

TTSClient synthesizes speech through the OpenAI audio speech API.

func NewTTSClient

func NewTTSClient(apiKey, apiBase, model, voice, instructions string) *TTSClient

NewTTSClient constructs a TTS client with sane defaults for missing model values.

func (*TTSClient) Synthesize

func (c *TTSClient) Synthesize(ctx context.Context, text string) (io.ReadCloser, error)

Synthesize sends text to the speech API and returns the streamed audio body.

func (*TTSClient) SynthesizeFormat

func (c *TTSClient) SynthesizeFormat(ctx context.Context, text, responseFormat string) (io.ReadCloser, error)

SynthesizeFormat sends text to the speech API using the requested format and returns the streamed audio body.

type WhisperClient

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

WhisperClient transcribes audio through the OpenAI transcription API.

func NewWhisperClient

func NewWhisperClient(apiKey, apiBase, model, prompt string) *WhisperClient

NewWhisperClient constructs a transcription client with sane defaults.

func (*WhisperClient) Transcribe

func (c *WhisperClient) Transcribe(ctx context.Context, path string) (text string, err error)

Transcribe uploads the provided audio file and returns the recognized text.

Jump to

Keyboard shortcuts

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