Repository navigation
Conversation
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install -r requirements-examples.txt |
There was a problem hiding this comment.
we'd need to add speechmatics-rt and speechmatics-voice into requirements-examples.txt otherwise the scripts won't run
also it'd be nice to use venv to ensure this is reproducible
python -m venv .venv
source .venv/bin/activate
| cd examples/voice | ||
| pip install -r requirements-examples.txt |
There was a problem hiding this comment.
i don't think we need to duplicate this setup step since its already mentioned in Installation section
| @@ -0,0 +1,188 @@ | |||
| import asyncio | |||
There was a problem hiding this comment.
We should add more explanation about what this example does and what kind of logs the user should expect. Initially, I didn’t realise this file was focused on S2 until I actually saw S2 logs coming through. When I ran it with example.wav, I didn’t see any logs at first and thought something was wrong, but later understood that this was just how the file works.
| """ | ||
| # Parse command line arguments for audio file path | ||
| # Default to example.wav if no file specified | ||
| audio_file_path = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(__file__).parent / "../example2.wav" |
There was a problem hiding this comment.
could we use argparse or fire to expose this as a input flag?
also I think the focus_speakers param should be toggleable so that as a user I can test with different speaker_ids, not just S2
| @@ -0,0 +1,132 @@ | |||
| import asyncio | |||
There was a problem hiding this comment.
Some explanation here on what this example demonstrates would be nice too. It's not clear that we're focusing on S1 until I tested it and looked at the code.
| cd examples/voice | ||
| pip install -r requirements-examples.txt |
| # Send frames after delay | ||
| self._processor_task = asyncio.create_task(process_after_delay(self._processor_wait_time)) | ||
|
|
||
| def _calculate_ttfb(self, end_time: float) -> None: |
There was a problem hiding this comment.
I'm still not 100% convinced we call this TTFB. This is measuring audio lead time — how far ahead the client streamed past the audio that produced the first text.
True TTFB/TTFT should be the wall-clock difference between when streaming starts and when the first text arrives. And you only calculate it once per session
|
We've discussed this before but there’s a fair amount of custom logic (like discarding/ignoring speakers and grouping fragments by speaker). It would be valuable to add unit tests around it at some point, not necessarily in this MR. Otherwise, it’ll be difficult to make changes without unintentionally breaking existing functionality. |
|
Create a new PR. |
This is a beta version of the Voice Agent client for the Real-Time API.
It provides the following features:
VoiceAgentClientsub-class ofAsyncClient