vad

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package vad provides lightweight RMS-based voice activity hints for sip1 barge-in (interrupt TTS / local WAV toward the callee while synthetic audio is playing).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

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

Detector performs energy-based (RMS) gating suitable for barge-in while downlink synthesis plays.

func NewDetector

func NewDetector() *Detector

NewDetector builds a detector with sipold-aligned defaults.

func (*Detector) CheckBargeIn

func (v *Detector) CheckBargeIn(pcmData []byte, synthPlaying bool) bool

CheckBargeIn returns true when uplink PCM suggests the user is speaking during synthesis playback. pcmData must be 16-bit little-endian mono PCM (typically 20 ms @ 16 kHz from the sip1 decode path).

func (*Detector) SetConsecutiveFrames

func (v *Detector) SetConsecutiveFrames(frames int)

SetConsecutiveFrames sets how many consecutive over-threshold frames trigger barge-in.

func (*Detector) SetEnabled

func (v *Detector) SetEnabled(enabled bool)

SetEnabled turns detection on/off.

func (*Detector) SetLogger

func (v *Detector) SetLogger(logger *logrus.Logger)

SetLogger attaches an optional logrus logger (debug/info).

func (*Detector) SetThreshold

func (v *Detector) SetThreshold(threshold float64)

SetThreshold sets the RMS ceiling used with adaptive noise tracking.

Jump to

Keyboard shortcuts

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