Mycroft AI
  • Documentation
  • About Mycroft AI
    • Why use Mycroft AI?
    • Glossary of terms
    • Contributing
    • FAQ
  • Using Mycroft AI
    • Get Mycroft
      • Mark II
        • Mark II Dev Kit
      • Mark 1
      • Picroft
      • Linux
      • Mac OS and Windows with VirtualBox
      • Docker
      • Android
    • Pairing Your Device
    • Basic Commands
    • Installing New Skills
    • Customizations
      • Configuration Manager
      • mycroft.conf
      • Languages
        • Français (French)
        • Deutsch (German)
      • Using a Custom Wake Word
      • Speech-To-Text
      • Text-To-Speech
    • Troubleshooting
      • General Troubleshooting
      • Audio Troubleshooting
      • Wake Word Troubleshooting
      • Log Files
      • Support Skill
      • Getting more support
  • Skill Development
    • Voice User Interface Design Guidelines
      • What can a Skill do?
      • Design Process
      • Voice Assistant Personas
      • Interactions
        • Intents
        • Statements and Prompts
        • Confirmations
      • Conversations
      • Error Handling
      • Example Interaction Script
      • Prototyping
      • Design to Development
    • Development Setup
      • Python Resources
      • Your First Skill
    • Skill Structure
      • Lifecycle Methods
      • Logging
      • Skill Settings
      • Dependencies
        • Manifest.yml
        • Requirements files
      • Filesystem access
      • Skill API
    • Integration Tests
      • Test Steps
      • Scenario Outlines
      • Test Runner
      • Reviewing the Report
      • Adding Custom Steps
      • Old Test System
    • User interaction
      • Intents
        • Padatious Intents
        • Adapt Intents
      • Statements
      • Prompts
      • Parsing Utterances
      • Confirmations
      • Conversational Context
      • Converse
    • Displaying information
      • GUI Framework
      • Show Simple Content
      • Mycroft-GUI on a PC
      • Mark 1 Display
    • Advanced Skill Types
      • Fallback Skill
      • Common Play Framework
      • Common Query Framework
      • Common IoT Framework
    • Mycroft Skills Manager
      • Troubleshooting
    • Marketplace Submission
      • Skills Acceptance Process
        • Information Review Template
        • Code Review Template
        • Functional Review Template
        • Combined Template
      • Skill README.md
    • FAQ
  • Mycroft Technologies
    • Technology Overview
    • Roadmap
    • Mycroft Core
      • MessageBus
      • Message Types
      • Services
        • Enclosure
        • Voice Service
        • Audio Service
        • Skills Service
      • Plugins
        • Audioservice Plugins
        • STT Plugins
        • TTS Plugins
        • Wake Word Plugins
      • Testing
      • Legacy Repo
    • Adapt
      • Adapt Examples
      • Adapt Tutorial
    • Lingua Franca
    • Mimic TTS
      • Mimic 3
      • Mimic 2
      • Mimic 1
      • Mimic Recording Studio
    • Mycroft GUI
      • Remote STT and TTS
    • Mycroft Skills Kit
    • Mycroft Skills Manager
    • Padatious
    • Precise
    • Platforms
Powered by GitBook
On this page
  • execute()
  • STT base class
  • STT
  • StreamingSTT
  • Entry point

Was this helpful?

  1. Mycroft Technologies
  2. Mycroft Core
  3. Plugins

STT Plugins

PreviousAudioservice PluginsNextTTS Plugins

Last updated 4 years ago

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 :

  "stt": {
    "module": "example_stt",
    "example_stt": {
      "server": "https://my_server.com",
      "samplerate": 16000
    }
  }

will load the "example_stt" structure from the "stt" section and provide that in self.config.

execute()

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

class MySTT(STT):
    def execute(audio, language=None):
        # Handle audio data and return transcribed text
        [...]
        return text

STT base class

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.

Entry point

To make the class detectable as an STT plugin, the package needs to provide an entry point under the mycroft.plugin.stt namespace.

setup([...],
      entry_points = {'mycroft.plugin.stt': 'example_stt = my_stt:mySTT'}
      )

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.

Mycroft configuration
AudioData
StreamThread class