capture

package
v1.164.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 2 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 capture provides microphone capture using CoreAudio on macOS.

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 unavailable on the current platform.

Functions

This section is empty.

Types

type AudioHandler

type AudioHandler func(data []byte)

AudioHandler receives mono, 16-bit signed PCM (little-endian) audio chunks.

type Capturer

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

Capturer configures independent microphone capture runs.

func NewCapturer

func NewCapturer(sampleRate int) *Capturer

NewCapturer creates a capturer with the specified sample rate.

func (*Capturer) Run added in v1.152.0

func (c *Capturer) Run(context.Context, string, AudioHandler, func()) error

Run returns ErrNotSupported when native audio capture is unavailable.

Jump to

Keyboard shortcuts

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