vadproc

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package vadproc is the voice-activity-detection pipeline processor. It drives a vad.Analyzer over incoming audio and emits the raw VAD frames the turn subsystem consumes: VADUserStartedSpeakingFrame and VADUserStoppedSpeakingFrame on speech onset/offset, plus a periodic UserSpeakingFrame while the user speaks. It does not decide turns — that is the turns package's job.

Place it just after the input transport. The analyzer runs at the input sample rate when it supports it — so Silero runs natively on 8 kHz telephony audio, not an upsampled copy — and only resamples to 16 kHz when the input rate is rejected. The original input audio is always forwarded downstream unchanged so STT and the turn analyzer still see it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// VAD detects voice activity. Required.
	VAD vad.Analyzer
	// SpeechActivityPeriod is how often a UserSpeakingFrame is emitted while the
	// user is speaking; 0 uses 200ms, a negative value disables the keepalive.
	SpeechActivityPeriod time.Duration
}

Config configures a Processor.

type Processor

type Processor struct {
	*processor.Base
	// contains filtered or unexported fields
}

Processor is the VAD pipeline processor.

func New

func New(cfg Config) *Processor

New builds a VAD Processor. The VAD analyzer is required.

func (*Processor) Cleanup

func (p *Processor) Cleanup(ctx context.Context) error

Cleanup closes the analyzer and resampler.

func (*Processor) ProcessFrame

func (p *Processor) ProcessFrame(ctx context.Context, f frames.Frame, dir processor.Direction) error

ProcessFrame drives the analyzer from incoming audio and forwards frames.

Jump to

Keyboard shortcuts

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