A modular service that provides speech-to-text (STT) capabilities for machines running on the Viam platform.
This module implements the listen
and to_text
commands of the speech service API (viam-labs:service:speech
). Follow the documentation below to learn about how to use it with the Viam SDKs.
To use this module, follow these instructions to add a module from the Viam Registry and select the viam-labs:speech:stt-vosk
model from the stt-vosk
module.
On Linux:
run.sh
will automatically install the following system dependencies if not already set up on the machine:
python3-pyaudio
ffmpeg
alsa-tools
alsa-utils
flac
On MacOS, run.sh
will install the following dependencies before adding the modular resource using Homebrew:
brew install portaudio
Before configuring your speech service, you must also create a machine.
Navigate to the Config tab of your machine's page in the Viam app.
Click on the Services subtab and click Create service.
Select the speech
type, then select the speech:stt-vosk
model.
Click Add module, then enter a name for your speech service and click Create.
On the new component panel, copy and paste the following attribute template into your service’s Attributes box:
{
"model_name": "vosk-model-small-en-us-0.15",
"model_lang": "en-us",
"mic_name": "default",
}
These are the default values for these fields, none are required to be set for this service.
The following attributes are available for the viam-labs:speech:speechio
speech service:
Name | Type | Inclusion | Description |
---|---|---|---|
model_name |
string | Optional | The name of the pre-trained Vosk model to be used. Default: "vosk-model-small-en-us-0.15" . |
model_lang |
string | Optional | The spoken language for the model to process. Default: "en-us" . |
mic_name |
string | Optional | The name of the hardware device used for audio input if more than one is available. Default: "default" . |
Note
For more information, see Configure a Machine.
This project was bootstrapped and it managed by rye
. Follow the documentation for installing rye and then run the sync
command in your local git clone
of this project to get started:
git clone https://github.com/viam-labs/stt-vosk && cd stt-vosk
rye sync