Documentation
¶
Overview ¶
Package onset detects the first audible sample in a stream of PCM audio. A TTS service measures the leading silence it pads onto the start of its response by feeding audio here as it streams; the leading-silence duration turns time-to-first-byte into time-to-first-audio (the perceived latency).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Detect ¶
Detect returns the per-channel sample index of the first sustained audible onset in pcm (16-bit signed little-endian samples, numChannels interleaved), or -1 when no confirmed onset is present yet. Feed it a growing buffer as audio streams in and stop once it returns a non-negative index.
Types ¶
This section is empty.