STT Plugins
Last updated
Was this helpful?
Last updated
Was this helpful?
All Mycroft STT Plugins need to provide a class derived from the STT base class in mycroft.stt
.
When the __init__()
method of the base class is run the config for that module will be loaded and available through self.config
. Mycroft's selected language will also be available through self.lang
.
For example, the following :
will load the "example_stt"
structure from the "stt"
section and provide that in self.config
.
Each STT plugin class needs to define the execute()
method taking two arguments:
audio
( object) - the audio data to be transcribed.
lang
(str) - optional - the BCP-47 language code (currently not used in core).
The bare minimum STT class will look something like
The STT system has a couple of base classes specified.
STT
The base STT, this handles the audio in "batch mode" taking a complete audio file, and returning the complete transcription.
StreamingSTT
A more advanced STT class for streaming data to the STT. This will receive chunks of audio data as they become available and they are streamed to an STT engine.
To make the class detectable as an STT plugin, the package needs to provide an entry point under the mycroft.plugin.stt
namespace.
Where example_stt
is is the STT module name for the plugin, my_stt is the Python module and mySTT is the class in the module to return.
The plugin author needs to implement the create_streaming_thread()
method creating a thread for handling data sent through self.queue
. The thread this method creates should be based on the . handle_audio_data()
method also needs to be implemented.