MycroftAI / mycroft-core

Mycroft Core, the Mycroft Artificial Intelligence platform.
https://mycroft.ai
Apache License 2.0
6.51k stars 1.27k forks source link

Discussion: Audioservice support for sound effects #2965

Open forslund opened 3 years ago

forslund commented 3 years ago

A "sound effect" audio service component could be useful.

Things like the alarm and timer skill uses sound effects to handle alarms and notifications. Adding such a service would reduce some of the code duplication in skills and make the user experience more coherent.

There is a value in keeping this outside the normal tracklist audioservice since we may want to overlap these. I.e pause the existing track list play the sound effect, resume playback. Or play the sound effect on top of the audio service.

Things that it could do:

~I think only one repeating sfx at a time should be handled, possibly a stack of the events so if a timer and an alarm is playing only one will sound will be output. The latest sfx will be the one playing. For example if the alarm is cancelled it would resume playing the timer.~

@ChanceNCounter suggested that if multiple repeating sfx's are running they should alternate which is a much better idea than the above in my opinion.

The query if sfx is playing can be good for the VK tests since it will make some of the wonkier tests in alarm / timer easier to implement.

ChanceNCounter commented 3 years ago

It could also alternate between repeating sounds, which could be useful if skills or their authors disagree with the user about relative urgency. Maybe you'd rather hear your timer, so you don't burn your dinner, whereas I'd rather hear an incoming call alert because people only voice call me when it's urgent.

beep beep, beep beep ring ring beep beep, beep beep

forslund commented 3 years ago

Updated the proposal with your suggestion.

forslund commented 3 years ago

A first draft can be seen here: https://github.com/forslund/mycroft-core/commit/b6cfd183353daeffd08ede05463677a917197337

krisgesling commented 3 years ago

Yeah nice one.

It also feels like there may be different levels of importance for sound effects, off the top of my head:

Not sure exactly how they should all be handled, but more to suggest that we may need a parameter for this level of importance so that we can handle them differently.

forslund commented 3 years ago

Good suggestion I'll add a way to provide the importance level to the api and make sure the they are stored in separate lists then maybe open a PR for more discussion if this is something the mycroft core team would like.

krisgesling commented 3 years ago

I think hold off doing too much just yet. We have a Music Skills sprint coming up shortly that will have to include looking at the Common Play and Audiobackend Services so things will probably shift significantly through this.