voice

package
v0.167.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() bool

Available checks if sox/rec is installed.

Types

type Engine

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

func New

func New(openAIKey string) *Engine

func (*Engine) RecordCtx added in v0.24.0

func (e *Engine) RecordCtx(ctx context.Context, outPath string) error

RecordCtx captures audio from the microphone using sox until the silence detector fires or the recordTimeout fallback expires. The caller's ctx is honoured: cancelling it kills the rec process. Records 16kHz mono WAV, stops after 1s of silence.

func (*Engine) RecordFixed

func (e *Engine) RecordFixed(outPath string, seconds int) error

RecordFixed captures audio for a fixed duration in seconds.

func (*Engine) TranscribeCtx added in v0.24.0

func (e *Engine) TranscribeCtx(ctx context.Context, audioPath string) (string, error)

TranscribeCtx loads audioPath and forwards it to TranscribeReaderCtx. Honours ctx — cancelling it aborts the in-flight HTTP request so the REPL can return immediately on Ctrl+C even if the API hangs.

func (*Engine) TranscribeReaderCtx added in v0.24.0

func (e *Engine) TranscribeReaderCtx(ctx context.Context, audio io.Reader, filename string) (string, error)

TranscribeReaderCtx sends audio from a reader to OpenAI Whisper API. Honours ctx — cancelling it aborts the in-flight HTTP request so the REPL can return immediately on Ctrl+C even if the API hangs.

Jump to

Keyboard shortcuts

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