onset

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: BSD-2-Clause Imports: 1 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 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

func Detect(pcm []byte, sampleRate, numChannels int) int

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.

Jump to

Keyboard shortcuts

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