Documentation
¶
Index ¶
- Constants
- func GetPlatform() (string, bool)
- type Module
- func (m *Module) FeaturesFromBuiltin(modelsDir, libtensorflowliteCPath *string) (*OpenWakeWordFeatures, error)
- func (m *Module) FromBuiltin(model string, modelsDir, libtensorflowliteCPath *string) (*OpenWakeWord, error)
- func (m *Module) FromModel(modelPath string, libtensorflowliteCPath *string) (*OpenWakeWord, error)
- func (m *Module) LoadLibrary() error
- type OpenWakeWord
- type OpenWakeWordFeatures
- type PyError
- type TfLiteWakeWord
Constants ¶
const ( BatchSize = 1 AutofillSeconds = 8 MaxSeconds = 10 SampleRate = 16000 SamplesPerChunk = 1280 MsPerChunk = SamplesPerChunk / SampleRate MelsPerSecond = 97 MaxMels = MaxSeconds * MelsPerSecond MelSamples = 1760 NumMels = 32 EmbFeatures = 76 EmbStep = 8 MaxEmb = MaxSeconds * EmbStep WWFeatures = 96 )
Constants of the openWakeWord pipeline, 80 ms chunks at 16 kHz through mel, embedding and classifier windows
const ( ModelOkayNabu = "okay_nabu" ModelHeyJarvis = "hey_jarvis" ModelHeyMycroft = "hey_mycroft" ModelAlexa = "alexa" ModelHeyRhasspy = "hey_rhasspy" )
Built in openWakeWord model names
Variables ¶
This section is empty.
Functions ¶
func GetPlatform ¶
Library directory name for this host, false where no tensorflowlite_c build exists
Types ¶
type Module ¶
type Module struct{ Dir string }
The imported pyopen_wakeword package rooted at its directory
func (*Module) FeaturesFromBuiltin ¶
func (m *Module) FeaturesFromBuiltin(modelsDir, libtensorflowliteCPath *string) (*OpenWakeWordFeatures, error)
Loads the shared feature models from the models directory, the package one when modelsDir is nil
func (*Module) FromBuiltin ¶
func (m *Module) FromBuiltin(model string, modelsDir, libtensorflowliteCPath *string) (*OpenWakeWord, error)
Loads a built in classifier by name from the models directory, the package one when modelsDir is nil
func (*Module) FromModel ¶
func (m *Module) FromModel(modelPath string, libtensorflowliteCPath *string) (*OpenWakeWord, error)
Loads a classifier from a model file, finding the bundled library when no library path is given
func (*Module) LoadLibrary ¶
Loads the tensorflowlite_c library the package carries and binds the functions the models call
type OpenWakeWord ¶
type OpenWakeWord struct {
*TfLiteWakeWord
TfliteModel string
// contains filtered or unexported fields
}
One wake word classifier over rolling embedding windows
func (*OpenWakeWord) ProcessStreaming ¶
func (w *OpenWakeWord) ProcessStreaming(embeddings []float32, yield func(float32) bool) error
Feeds embedding windows and yields one probability per classifier window that became ready
func (*OpenWakeWord) Reset ¶
func (w *OpenWakeWord) Reset()
Clears the rolling embeddings so earlier audio cannot score
type OpenWakeWordFeatures ¶
type OpenWakeWordFeatures struct {
*TfLiteWakeWord
MelPath string
EmbPath string
// contains filtered or unexported fields
}
Turns streamed audio into embedding windows through the mel and embedding models
func (*OpenWakeWordFeatures) Close ¶
func (f *OpenWakeWordFeatures) Close()
Releases both interpreters and both models
func (*OpenWakeWordFeatures) ProcessStreaming ¶
func (f *OpenWakeWordFeatures) ProcessStreaming(audioChunk []byte, yield func([]float32) bool) error
Feeds 16 bit native endian audio and yields each embedding window group that became ready
func (*OpenWakeWordFeatures) Reset ¶
func (f *OpenWakeWordFeatures) Reset()
Clears the rolling audio and mel buffers back to the freshly built state
type PyError ¶
type PyError struct{ Class, Msg string }
A builtin Python exception the package raises, named by its class
type TfLiteWakeWord ¶
type TfLiteWakeWord struct {
LibtensorflowliteCPath string
// contains filtered or unexported fields
}
The base of both wake word classes, the resolved library path and the bound library