capture

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package capture provides audio capture functionality. This is a stub implementation for non-macOS platforms.

Index

Constants

View Source
const (
	SampleRate44100 = 44100 // CD quality, used for WAV recording
	SampleRate24000 = 24000 // Required by OpenAI Realtime API
)

Common sample rates

Variables

View Source
var ErrNotSupported = errors.New("audio capture is only supported on macOS")

ErrNotSupported is returned when audio capture is not supported on the current platform.

Functions

This section is empty.

Types

type AudioHandler

type AudioHandler func(data []byte)

AudioHandler is called for each chunk of captured audio data. The data is mono, 16-bit signed PCM (little-endian).

type Capturer

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

Capturer records audio from the microphone. On non-macOS platforms, this is a stub that returns errors.

func NewCapturer

func NewCapturer(sampleRate int) *Capturer

NewCapturer creates a new audio capturer with the specified sample rate.

func (*Capturer) IsCapturing

func (c *Capturer) IsCapturing() bool

IsCapturing always returns false on non-macOS platforms.

func (*Capturer) Record

func (c *Capturer) Record(filePath string, duration time.Duration) error

Record returns ErrNotSupported on non-macOS platforms.

func (*Capturer) Start

func (c *Capturer) Start(filePath string, handler AudioHandler) error

Start returns ErrNotSupported on non-macOS platforms.

func (*Capturer) Stop

func (c *Capturer) Stop() error

Stop returns ErrNotSupported on non-macOS platforms.

func (*Capturer) Stream

func (c *Capturer) Stream(duration time.Duration, handler AudioHandler) error

Stream returns ErrNotSupported on non-macOS platforms.

Jump to

Keyboard shortcuts

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