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
  • AudioBackend
  • RemoteAudioBackend
  • Instantiation
  • Entry point

Was this helpful?

  1. Mycroft Technologies
  2. Mycroft Core
  3. Plugins

Audioservice Plugins

An Audioservice Backend plugin adds an interface to a media player allowing Mycroft to play new types of media files or on remote devices.

PreviousPluginsNextSTT Plugins

Last updated 4 years ago

Was this helpful?

AudioBackend

Each Audioservice plugin must implement a class derived from AudioBackend found in mycroft.audio.service. This class implements all basic commands and will be called by Mycroft. For complete specification see the for the class.

Apart from the expected commands (play, pause, etc), there are a couple of important methods to mention.

The supported_uris() method this is used to determine if the service backend can handle the given uri-type (https://, file://, etc). A basic implementation will return an iterable with uri types: ('file', 'http', 'https')

The playlist handling methods clear_list() and add_list(), of which the first removes all items from the current list, and the second appends a list of uri's to the list.

RemoteAudioBackend

If the audio backend that is implemented plays media on another device than the one Mycroft is running on this base class should be used. It is mainly used to sort generic playback queries defaulting to a local audio backend unless otherwise specified.

Instantiation

An audioservice can instantiate a number of backend objects so an instantiation function called load_service() needs to exist in the module. It will be called with the Mycroft audio configuration and a connection to the messagebus. The method should return a tuple with audio backends included in the file.

The load_service() function can also be used to scan the local network for things like chromecast and create an audioservice backend for each found device.

The basic layout of an Audioservice Plugin will be:

from mycroft.audio.service import AudioBackend

class MyAudioBackend(AudioBackend)
    #lots of implementation here
    [...]


def load_service(config, bus):
    return (MyAudioBackend(config, bus), )

Entry point

To make the audioservice detectable as an Audioservice Backend Plugin, the package needs to provide an entry point under the mycroft.plugin.audioservice namespace.

setup([...],
      entry_points = {'mycroft.plugin.audioservice': 'example_audiobackend = my_audiobackend'}
      )

Where example_audiobackend is the audio service module name for the plugin, my_audiobackend will be the audioservice module containing the load_service() function.

Note that this differs a fair bit from the TTS and STT Plugin entry points that point to a single class.

Example Audioservices can be found .

docstrings
here