Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/improve_legacy_support #63

Merged
merged 8 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 47 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Handles TTS generation and sounds playback
plugins.

Without `extras`, you will also need to manually install,
and possibly configure TTS and Audio Backend modules as described below.
and possibly configure TTS modules as described below.

# Configuration

Expand All @@ -20,16 +20,11 @@ under mycroft.conf
{

// Text to Speech parameters
// Override: REMOTE
"tts": {
"pulse_duck": false,
"module": "ovos-tts-plugin-mimic3-server",
"module": "ovos-tts-plugin-server",
"fallback_module": "ovos-tts-plugin-mimic",
"ovos-tts-plugin-mimic": {
"voice": "ap"
},
"ovos-tts-plugin-mimic3-server": {
"voice": "en_UK/apope_low"
}
},

Expand All @@ -42,15 +37,56 @@ under mycroft.conf
},

// Mechanism used to play WAV audio files
// Override: SYSTEM
"play_wav_cmdline": "paplay %1 --stream-name=mycroft-voice",

// Mechanism used to play MP3 audio files
// Override: SYSTEM
"play_mp3_cmdline": "mpg123 %1",

// Mechanism used to play OGG audio files
// Override: SYSTEM
"play_ogg_cmdline": "ogg123 -q %1"
}
```
```

## Using Legacy AudioService

The legacy audio service supports audio playback via the old mycroft api ([@mycroft](https://github.com/MycroftAI/mycroft-core/blob/dev/mycroft/skills/audioservice.py#L43) [@ovos](https://github.com/OpenVoiceOS/ovos-bus-client/blob/dev/ovos_bus_client/apis/ocp.py#L51))

by default OCP acts as a translation layer for this api and no action is needed, but if you want to disable ocp this api remains available

> **NOTE:** once ovos-media is released OCP and this api will be disabled by default and deprecated!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion(non-blocking): use ```json for better formatting, potentially?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

markdown rendering in github doesnt like comments, thats why i use javascript usually, avoids the red highlights as it would be invalid json but is a valid javascript comment

```javascript
{
"enable_old_audioservice": true,
"disable_ocp": true,
"Audio": {
"default-backend": "vlc",
"backends": {
"simple": {
"type": "ovos_audio_simple",
"active": true
},
"vlc": {
"type": "ovos_vlc",
"active": true
}
}
}
},
}
```

legacy plugins:
- [ocp](https://github.com/OpenVoiceOS/ovos-ocp-audio-plugin)
- [vlc](https://github.com/OpenVoiceOS/ovos-vlc-plugin)
- [simple](https://github.com/OpenVoiceOS/ovos-audio-plugin-simple) (no https support)

**OCP technical details:**

- OCP was developed for mycroft-core under this legacy system
- OCP will pose as a legacy plugin and translate the received bus events to the [OCP api](https://github.com/OpenVoiceOS/ovos-bus-client/blob/dev/ovos_bus_client/apis/ocp.py#L228)
- OCP is **always** the default audio plugin, unless you set `"disable_ocp": true` in config
- OCP uses the legacy api internally, to delegate playback when GUI is not available (or configured to do so)
- this does **NOT** bring support for old Mycroft CommonPlay skills, that is related to skills service not ovos-audio
- this brings support for [OCP skills](https://openvoiceos.github.io/ovos-technical-manual/OCP_skills) to OVOS until [ovos-media](https://github.com/OpenVoiceOS/ovos-media) is finished
- [ovos-media](https://github.com/OpenVoiceOS/ovos-media) will fully replace OCP in **ovos-audio 0.2.0**
11 changes: 8 additions & 3 deletions ovos_audio/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class PlaybackService(Thread):
def __init__(self, ready_hook=on_ready, error_hook=on_error,
stopping_hook=on_stopping, alive_hook=on_alive,
started_hook=on_started, watchdog=lambda: None,
bus=None, disable_ocp=False, validate_source=True):
bus=None, disable_ocp=None, validate_source=True):
super(PlaybackService, self).__init__()

LOG.info("Starting Audio Service")
Expand Down Expand Up @@ -97,6 +97,9 @@ def __init__(self, ready_hook=on_ready, error_hook=on_error,

self.audio = None
self.audio_enabled = self.config.get("enable_old_audioservice", True) # TODO default to False soon
if disable_ocp is None:
disable_ocp = self.config.get("disable_ocp", False) # TODO default to True soon
self.disable_ocp = disable_ocp
if self.audio_enabled:
try:
self.audio = AudioService(self.bus, disable_ocp=disable_ocp, validate_source=validate_source)
Expand Down Expand Up @@ -243,8 +246,10 @@ def handle_opm_audio_query(self, message):
def run(self):
self.status.set_alive()
if self.audio_enabled:
LOG.warning("audio service has moved to ovos-media, if you already migrated to ovos-media "
'set "enable_old_audioservice": false in mycroft.conf')
LOG.info("Legacy AudioService enabled")
if not self.disable_ocp:
LOG.warning("OCP has moved to ovos-media, if you already migrated to ovos-media "
'set "disable_ocp": true in mycroft.conf')
if self.audio.wait_for_load():
if len(self.audio.service) == 0:
LOG.warning('No audio backends loaded! '
Expand Down
Loading