Add flush_audio to FishTTSService
This commit is contained in:
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Added support for Chirp voices in `GoogleTTSService`.
|
- Added support for Chirp voices in `GoogleTTSService`.
|
||||||
|
|
||||||
|
- Added a `flush_audio()` method to `FishTTSService`.
|
||||||
|
|
||||||
- Added `on_user_turn_audio_data` and `on_bot_turn_audio_data` to
|
- Added `on_user_turn_audio_data` and `on_bot_turn_audio_data` to
|
||||||
`AudioBufferProcessor`. This gives the ability to grab the audio of only that
|
`AudioBufferProcessor`. This gives the ability to grab the audio of only that
|
||||||
turn for both the user and the bot.
|
turn for both the user and the bot.
|
||||||
|
|||||||
@@ -148,6 +148,14 @@ class FishAudioTTSService(InterruptibleTTSService):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error closing websocket: {e}")
|
logger.error(f"Error closing websocket: {e}")
|
||||||
|
|
||||||
|
async def flush_audio(self):
|
||||||
|
"""Flush any buffered audio by sending a flush event to Fish Audio."""
|
||||||
|
logger.trace(f"{self}: Flushing audio buffers")
|
||||||
|
if not self._websocket:
|
||||||
|
return
|
||||||
|
flush_message = {"event": "flush"}
|
||||||
|
await self._get_websocket().send(ormsgpack.packb(flush_message))
|
||||||
|
|
||||||
def _get_websocket(self):
|
def _get_websocket(self):
|
||||||
if self._websocket:
|
if self._websocket:
|
||||||
return self._websocket
|
return self._websocket
|
||||||
|
|||||||
Reference in New Issue
Block a user