Documentation
¶
Overview ¶
Package audiocap captures the host's current audio output (whatever's already playing — desktop sounds, Amp, Vid, a bridged app) as raw PCM, for internal/attach to stream to an attached remote client. It shells out to parec against the default sink's monitor source — never a microphone — mirroring internal/ffdecode's ffmpeg-subprocess pattern: no linked capture library, a soft runtime dependency only needed if audio streaming is actually turned on. parec covers both PulseAudio proper and PipeWire systems running pipewire-pulse, which is the default on nearly every modern desktop distro; pw-record has no equivalently portable "default sink monitor" target name, so it isn't wired up here.
Index ¶
Constants ¶
const ( SampleRate = 48000 Channels = 2 )
SampleRate/Channels match internal/audio's fixed output format, so a captured chunk can go straight to an attached client's Playback with no resampling.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
Err error
}
Event is how a Stream's feeder goroutine reports back — never by touching caller state directly, exactly like internal/ffdecode.AudioEvent.
type Stream ¶
type Stream struct {
PCM chan []int16
// contains filtered or unexported fields
}
Stream captures raw PCM from the default sink's monitor via a parec subprocess. PCM delivers interleaved int16 samples at SampleRate/Channels.