feat: improve semantic voice control and music playback
This commit is contained in:
@@ -286,6 +286,9 @@ class TextToSpeech:
|
||||
if not text.strip():
|
||||
return True
|
||||
|
||||
if check_interrupt is None:
|
||||
check_interrupt = self._default_interrupt_checker()
|
||||
|
||||
if language == "ru":
|
||||
text = self._preprocess_text(text)
|
||||
segments = self._split_mixed_language(text)
|
||||
@@ -296,6 +299,14 @@ class TextToSpeech:
|
||||
text, check_interrupt=check_interrupt, language=language
|
||||
)
|
||||
|
||||
def _default_interrupt_checker(self):
|
||||
try:
|
||||
from .wakeword import check_wakeword_once
|
||||
|
||||
return check_wakeword_once
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def _resample_audio(self, audio_np: np.ndarray, src_rate: int, dst_rate: int):
|
||||
if src_rate == dst_rate:
|
||||
return audio_np.astype(np.float32, copy=False)
|
||||
|
||||
Reference in New Issue
Block a user