-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Audio service #433
Audio service #433
Conversation
872805e to
4bbb3e9
Compare
|
Major refactoring done after discussion with @ethanaward. The audio backends now runs separately from the skills. The loading of backends is now done using a method similar to how the skills work and should be easy to extend to include thirdparty backends. |
|
Skills using the audio service interface most important, the playback control skill: The playback control skills implement the common commands for skills using the audio service. like skipping tracks, pausing and resuming. The idea is that the skill creator only needs to implement the finding of audio files and the command that starts playback. (The other commands are of course available to the skill creator if they wish to use them) |
228d48a to
306bbf5
Compare
|
Finally rebased, phew |
mycroft/audio/main.py
Outdated
| logger.info('no default found') | ||
| logger.info('Default:' + str(default)) | ||
|
|
||
| ws.on('MycroftAudioServicePlay', _play) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change to mycroft.audio.service.play like the others mycroft events
Pause, resume, next and previous added to the interface. The play method was updated to add 'file://' to uri's lacking uri type.
As requested by Augusto Monteiro
Removes the cases where the process keeps playing in the background when a new track is started.
* import Message to allow audio service to reply info * Add default message to audio service class
when the audio configuration option "pulseaudio" is set to mute running audio streams will be muted while mycroft is speaking and while mycroft is listening.
|
So why isn't this merged yet! Reviewed by Augusto, merge away! |
In late November @penrods led a discussion about how an audio service in Mycroft could work. This is a simple implementation of what was discussed. This is a quick implementation of the system as I understood it and I think this can be used to continue the discussion. Ideas and suggestions on improvements are very welcome.
The PR adds support for commands like
"Hey Mycroft, play the news in the livingroom"
Backends
The current system includes support for the following "backends"
"backends" currently in the works:
Backends are quite easy to add and an existing baseclass can be extended to add new ones.
AudioService
Skill creators will use an audio service interface to communicate with the audio service / playback control. the AudioService interface uses the standard message bus.
See the npr_news skill for basic usage.
The AudioService currently only support play and track_info requests but this will probably be expanded for increased usefulness.
Playback control skill
Features:
The backend/location selection is currently done using basic string parsing and should probably be done using adapt instead.
This skill removes much of the basic functions that needs to be implemented for an audio playback skill and the skill creator can focus on the trickier parts.
Currently most of the audio logic is implemented in the playback control skill and should maybe be moved but this was a good starting point.
Configuration
A Configuration the audio services:
{ "Audio": { "backends": { "local": { "type": "mpg123", "active": true }, "kitchen": { "type": "mopidy", "url": "http://localhost:6680", "active": true }, "livingroom": { "type": "mopidy", "url": "http://192.168.10.232:6680", "active": false }, "vlc": { "type": "vlc", "active": true } }, "default-backend": "local" } }If you try it I suggest you install vlc and pyvlc and use the vlc backend since mpg123 only has basic functionallity.
I've tested this mainly with the mopidy skill and the npr_news skill.
Todo