Skip to content

Commit

Permalink
set azure trailing silence to be as low as possible (#331)
Browse files Browse the repository at this point in the history
* set trailing silence to be as low as possible

* seed with 1 second of silence so the stream can warm up
  • Loading branch information
ajar98 authored Aug 3, 2023
1 parent af8b7b0 commit 717514c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions vocode/streaming/output_device/blocking_speaker_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(
device=int(self.device_info["index"]),
)
self._ended = False
self.input_queue.put_nowait(self.sampling_rate * b"\x00")
self.stream.start()

def start(self):
Expand Down
5 changes: 5 additions & 0 deletions vocode/streaming/synthesizer/azure_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ def create_ssml(
"styledegree", str(bot_sentiment.degree * 2)
) # Azure specific, it's a scale of 0-2
voice_root = styled
silence = ElementTree.SubElement(
voice_root, "{%s}silence" % NAMESPACES.get("mstts")
)
silence.set("value", "500ms")
silence.set("type", "Tailing-exact")
prosody = ElementTree.SubElement(voice_root, "prosody")
prosody.set("pitch", f"{self.pitch}%")
prosody.set("rate", f"{self.rate}%")
Expand Down

0 comments on commit 717514c

Please sign in to comment.