Documentation
¶
Overview ¶
Package wake slides a fixed window over 16 kHz audio, scores it every hop and debounces accepted windows into wake-word detections.
It is phonmatchnet-run's internal/listen, made push-driven: the caller writes audio frames of any size as they arrive, instead of the listener reading a stream on its own goroutine. Window placement and debouncing are unchanged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Window int // samples scored per window
Hop int // samples between window ends
// Confirm is how many consecutive accepted windows make a detection.
Confirm int
// Refractory is how long after a detection, measured from its window's
// end, no window counts toward another one. A refractory period of at
// least Window keeps one utterance from firing twice.
Refractory int
}
Config sets the window geometry and debouncing, in samples.
type Listener ¶
type Listener[T any] struct { // contains filtered or unexported fields }
Listener holds the most recent Window samples and the debounce state. It is not safe for concurrent use.
func (*Listener[T]) Write ¶
func (l *Listener[T]) Write(ctx context.Context, samples []float32, emit func(Event[T]) error) error
Write appends samples, which continue the stream, and scores a window at every hop boundary once Window samples have arrived, calling emit for each. A frame that crosses several boundaries scores several windows. Errors from score or emit stop Write; the samples up to that window have been consumed.
type Score ¶
Score scores one window and reports whether it is accepted.
func PhonMatchNet ¶
func PhonMatchNet(engine *phonmatchnet.Engine, keyword phonmatchnet.Keyword, far float64) Score[phonmatchnet.Result]
PhonMatchNet scores each window against keyword with engine at the calibrated operating point far (zero selects phonmatchnet.DefaultFAR). Window must be 0.5 to 2 seconds of 16 kHz audio.