vad

package
v0.10.0-dev.71 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package vad is a line-by-line Go port of WebRTC's voice activity detector (chromium/webrtc common_audio/vad/, BSD-3-Clause, Copyright (c) 2012 The WebRTC project authors): the allpass filter bank, log energy features, GMM classifier and adaptive model update. A Detector yields one log-likelihood ratio per 10 ms frame and Deciders threshold that one stream.

Index

Constants

View Source
const FrameSamples = 80

FrameSamples is 10 ms of 8 kHz mono PCM, the frame Detector.LLR reads.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decider

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

Decider turns one stream's ratios into speech decisions: a ratio at or above its threshold is speech, and so are the overhang frames after it.

func NewDecider

func NewDecider(threshold float64, overhang int) *Decider

NewDecider returns a decider with the given threshold and an overhang of that many frames.

func (*Decider) Speech

func (d *Decider) Speech(llr float64) bool

Speech reports whether the frame whose ratio is llr is speech; frames are passed in stream order.

type Detector

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

Detector reads one 8 kHz mono stream frame by frame. It is not safe for concurrent use.

func NewDetector

func NewDetector() *Detector

NewDetector returns a mode 3 detector whose model adapts at the smallest step the fixed point allows.

func (*Detector) LLR

func (d *Detector) LLR(frame []int16) float64

LLR classifies the stream's next frame, which holds FrameSamples samples, and returns its summed weighted log-likelihood ratio: the speech evidence a Decider thresholds.

Jump to

Keyboard shortcuts

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