wakewordutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLibraryNotFound = errors.New("tensorflowlite_c library not found")

Error for a bundle with no tensorflowlite_c library in the places it keeps one

View Source
var ErrModelShape = errors.New("unexpected wake word model tensor shape")

Error for a model whose tensors do not have the sizes the wake word pipeline feeds and reads

View Source
var ErrPartialFrame = errors.New("wake word input ends in a partial frame")

Error for input that ends in a partial sample or embedding window

View Source
var ErrUnsupportedPlatform = errors.New("no tensorflowlite_c build for " + runtime.GOOS + "/" + runtime.GOARCH)

Error for a platform that bundles carry no tensorflowlite_c build for

Functions

This section is empty.

Types

type Bundle

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

Installed openWakeWord bundle directory: a lib directory with the tensorflowlite_c library and a models directory with the feature models

func NewBundle

func NewBundle(dir string) *Bundle

Bundle of the directory dir

func (*Bundle) Features

func (b *Bundle) Features() (*Features, error)

Feature front end over the bundle's mel spectrogram and embedding models

func (*Bundle) Model

func (b *Bundle) Model(path string) (*Model, error)

Classifier from a model file over the bundle's runtime

func (*Bundle) Runtime

func (b *Bundle) Runtime() (*Runtime, error)

The bundle's tensorflowlite_c runtime, loaded on first success from the bundle's lib directory, else lib/<platform> beside the bundle directory

type CallError

type CallError struct {
	Model    string
	Function string
	Status   int32
}

TensorFlow Lite call on a model file that returned NULL or a failing status

func (*CallError) Error

func (e *CallError) Error() string

Model file, function and what it returned

type Features

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

Streaming front end that turns 16 kHz 16-bit mono audio into embedding windows through the mel spectrogram and embedding models; not safe for concurrent use

func (*Features) Close

func (f *Features) Close()

Releases both interpreters and both models, later calls doing nothing

func (*Features) ProcessStreaming

func (f *Features) ProcessStreaming(audioChunk []byte, yield func([]float32) bool) error

Feeds 16-bit native endian mono audio and yields each group of embedding windows that becomes ready, stopping when yield returns false; nothing once closed; the yielded slice is only valid until yield returns

func (*Features) Reset

func (f *Features) Reset()

Clears the rolling audio and mel buffers back to their freshly loaded state

type Model

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

One wake word classifier scoring rolling windows of embeddings; not safe for concurrent use

func (*Model) Close

func (m *Model) Close()

Releases the interpreter and the model, later calls doing nothing

func (*Model) ID

func (m *Model) ID() string

Name of the model, the stem of its file name

func (*Model) ProcessStreaming

func (m *Model) ProcessStreaming(embeddings []float32, yield func(float32) bool) error

Feeds embedding windows and yields one score per classifier window that becomes ready, stopping when yield returns false; nothing once closed

func (*Model) Reset

func (m *Model) Reset()

Clears the rolling embeddings so earlier audio cannot score

type Runtime

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

TensorFlow Lite C library with the functions the wake word models call bound, kept loaded for the life of the process

func OpenRuntime

func OpenRuntime(path string) (*Runtime, error)

Runtime over the tensorflowlite_c library file at path, its symbols made global for the delegates it loads

func (*Runtime) Features

func (rt *Runtime) Features(melPath, embPath string) (*Features, error)

Front end over the mel spectrogram and embedding model files, eight seconds of silence counted as pending audio so the first chunks already score

func (*Runtime) Model

func (rt *Runtime) Model(path string) (*Model, error)

Classifier from a model file, named by the file's stem, its window count read from the model's input shape

Jump to

Keyboard shortcuts

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