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

fix/ducking #60

Merged
merged 1 commit into from
Apr 29, 2024
Merged
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
17 changes: 13 additions & 4 deletions ovos_audio/playback.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random
from ovos_audio.transformers import TTSTransformersService
from ovos_bus_client.message import Message
from ovos_config import Configuration
from ovos_plugin_manager.templates.tts import TTS
from ovos_utils.log import LOG, log_deprecation
from ovos_utils.sound import play_audio
Expand Down Expand Up @@ -55,8 +56,12 @@ def clear_queue(self):
def begin_audio(self, message=None):
"""Perform beginning of speech actions."""
if self.bus:
if not self.tts.config.get("pulse_duck", False):
self.bus.emit(Message("ovos.common_play.duck"))
cfg = Configuration().get("tts", {})
if not cfg.get("pulse_duck"): # OS is configured to use pulseaudio modules directly
if cfg.get("ocp_cork", False):
self.bus.emit(Message("ovos.common_play.cork"))
elif cfg.get("ocp_duck", False):
self.bus.emit(Message("ovos.common_play.duck"))
message = message or Message("speak")
self.bus.emit(message.forward("recognizer_loop:audio_output_start"))
else:
Expand All @@ -70,8 +75,12 @@ def end_audio(self, listen, message=None):
listen (bool): True if listening event should be emitted
"""
if self.bus:
if not self.tts.config.get("pulse_duck", False):
self.bus.emit(Message("ovos.common_play.unduck"))
cfg = Configuration().get("tts", {})
if not cfg.get("pulse_duck"): # OS is configured to use pulseaudio modules directly
if cfg.get("ocp_cork", False):
self.bus.emit(Message("ovos.common_play.uncork"))
elif cfg.get("ocp_duck", False):
self.bus.emit(Message("ovos.common_play.unduck"))
# Send end of speech signals to the system
message = message or Message("speak")
self.bus.emit(message.forward("recognizer_loop:audio_output_end"))
Expand Down
Loading