Documentation
¶
Overview ¶
Package vadproc is the voice-activity-detection pipeline processor. It hosts a controller.Controller and turns what it hears into the raw VAD frames the turn subsystem consumes: VADUserStartedSpeakingFrame and VADUserStoppedSpeakingFrame on speech onset and offset, and UserSpeakingFrame for every chunk heard as speech. It does not decide turns, which is the turns package's job.
Place it just after the input transport. The detection itself, along with the resampling it needs and the watch for audio that stops arriving, lives in audio/vad/controller, so anything else needing the same detection can drive it without going through a pipeline. Frames are forwarded before detection runs over them, so audio keeps flowing and the rest of the pipeline is started before the parameters are reported.
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
// AudioIdleTimeout is how long to wait, with the user speaking and no audio
// arriving at all, before taking the speech to have stopped. It covers the
// audio going away mid-utterance, a muted microphone being the usual case:
// the detector never sees the silence that would have ended the speech, so
// without this the user is left speaking for good.
//
// Leave it nil for one second. A zero duration turns the watch off.
AudioIdleTimeout *time.Duration
}
Config configures a Processor.
type Processor ¶
Processor is the VAD pipeline processor.
func (*Processor) ProcessFrame ¶
func (p *Processor) ProcessFrame(ctx context.Context, f frames.Frame, dir processor.Direction) error
ProcessFrame forwards the frame and then lets the controller run over it.
It forwards first so the StartFrame reaches everything downstream before the parameters are reported, and so audio keeps flowing without waiting on detection.