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, build rustpotter models and tests them.
Installation
You can download rustpotter-cli binaries for the supported platforms from the 'Assets' tab of the releases, it can be installed like any other executable.
For instance on debian it can be installed like:
# This command print your arch, just in case you don't remember it.
# Here I used the armv7l binary
# Make executable
# Check simple execution
# Make available as ruspotter-cli
How to used it.
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.
Host warnings are hidden by default, you can enable them by providing the --host-warnings
option.
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.
You pass the id returned by the devices
commands using the --device-index
option to change the input device.
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
Filter a file.
The available audio filters in rustpotter can be applied to a wav file using the filter
command.
To enable the gain normalizer filter you can use the --gain-normalizer
option.
To enable the band-pass filter you can use the --band-pass
option.
To display the full command options you can run rustpotter-cli filter -h
.
This is an example run on macOS:
Creating a wakeword model
The build-model
command allows to create a wakeword file (also referred as model in this document).
You just need to provide the --model-name
option (which defines the detection name),
the --model-path
with the desired output path for the file, and a list of wav audio files.
For example:
rustpotter-cli build-model --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.
So it's recommended to record an example file using the record command and try to tune the options there to then test those for real.
This is an example run on macOS:
The more relevant options for the spot
and test-model
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).-a
configures theaveraged threshold
, recommended as reduces the cpu usage. (set to half of the threshold or similar)-m 6
require at least 6 frames of positive scoring (compared against the detectioncounter
field).-s
the comparison strategy used, defines the way the detection score is calculated from the different scores.-g
enables gain normalization. To debug the gain normalization you can use--debug-gain
.--gain-ref
changes the gain normalization reference (the default value is printed at the beginning when--debug-gain
is provided, changes with the model)-b --low-cutoff 500 --high-cutoff 1500
the band-pass filter configuration, helps to attenuate background noises.