Rustpotter CLI
CLI for Rustpotter, an open source wakeword spotter forged in rust
Description
This is a client for using the rustpotter library on the command line.
You can use it to record wav samples, create rustpotter wakeword files and test them.
Installation
Some pre-build executables for the supported platforms can be found on the 'Assets' tab of the releases.
Basic usage.
Listing available audio input devices and formats.
Your can list the available audio sources with the devices
command,
the --configs
option can be added to display the default and available record formats for each source.
Every device and config has a numerical id to the left which is the one you can use on the other commands (record
and spot
)
to change its audio source and format.
In some systems to many configurations are displayed you can filter them by max channel number using the parameter --max-channels
.
This is an example run on macOS:
Recording audio samples
The record
command allows to record audio samples.
To use a different input device provide the --device-index
argument with the id returned by the devices
commands.
You pass the configuration id returned by the devices
commands using the --config-index
option to change the audio format.
Once executed you need to press the Ctrl + c
key combination to finish the record.
This is an example run on macOS:
You can use something like this in bash to take multiple records quickly:
WAKEWORD="ok home"
WAKEWORD_FILENAME=""
# take 10 records, waiting one second after each.
for; do ( && ); done
Creating a Wakeword Model
The train
command allows to create wakeword models.
It's required to setup a training and testing folders containing wav records which need to be tagged (contains [label] in its file name, where 'label' is the tag the network should predict for that audio segment) or untagged (equivalent to contain [none] on the filename).
The size and cpu usage of a wakeword model is based on the model type you choose, and the audio duration it was trained on (which is defined by the max audio duration found on the training set).
Example run:
Note that you can obtain different results on different executions with the same training set as the initialization of the weights is not constant.
To get a correct idea about the accuracy of the model, do not share records between the train and test folders.
Creating a Wakeword Reference
The build
command allows to create a wakeword reference file from some records.
This wakeword type requires a low number of records to be created but offers more inconsistent results than the wakeword models.
As an example example:
rustpotter-cli build --model-name "ok home" --model-path ok_home.rpw ok_home1.wav ok_home2.wav
This is an example run on macOS:
Using a model
You can use the commands spot
to test a model in real time using the available audio inputs,
or test_model
to do it against an audio file.
Both expose similar options to make change from one to the other simpler.
This way you can record an example record and tune the options there to then test those on real time.
This is an example run on macOS:
The more relevant options for the spot
and test
commands are:
-d
parameter enables the called 'debug mode' so you can see the partial detections.-t
sets the threshold value (defaults to 0.5).-m 6
require at least 6 frames of positive scoring (compared against the detectioncounter
field).-e
enables the eager mode so detection is emitted as soon as possible (on min positive scores).-g
enables gain normalization. To debug the gain normalization you can use--debug-gain
, or look at the gain reflected on the detection.--gain-ref
changes the gain normalization reference. (the default value is printed at the beginning when--debug-gain
is provided, depends on the wakeword)