-
-
Notifications
You must be signed in to change notification settings - Fork 93
Add second audio channel for voice #1625
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4237,6 +4237,7 @@ async def test_subscribe_voice_assistant_api_audio( | |||||||||||||||||||||
| stops = [] | ||||||||||||||||||||||
| aborts = [] | ||||||||||||||||||||||
| data_received = 0 | ||||||||||||||||||||||
| data2_received = 0 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| async def handle_start( | ||||||||||||||||||||||
| conversation_id: str, | ||||||||||||||||||||||
|
|
@@ -4253,9 +4254,11 @@ async def handle_stop(abort: bool) -> None: | |||||||||||||||||||||
| else: | ||||||||||||||||||||||
| stops.append(True) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| async def handle_audio(data: bytes) -> None: | ||||||||||||||||||||||
| nonlocal data_received | ||||||||||||||||||||||
| async def handle_audio(data: bytes, data2: bytes | None = None) -> None: | ||||||||||||||||||||||
| nonlocal data_received, data2_received | ||||||||||||||||||||||
| data_received += len(data) | ||||||||||||||||||||||
| if data2: | ||||||||||||||||||||||
| data2_received += len(data2) | ||||||||||||||||||||||
|
Comment on lines
+4257
to
+4261
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use
🐛 Proposed fix- if data2:
+ if data2 is not None:
data2_received += len(data2)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| unsub = client.subscribe_voice_assistant( | ||||||||||||||||||||||
| handle_start=handle_start, handle_stop=handle_stop, handle_audio=handle_audio | ||||||||||||||||||||||
|
|
@@ -4298,10 +4301,12 @@ async def handle_audio(data: bytes) -> None: | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| response: message.Message = VoiceAssistantAudio( | ||||||||||||||||||||||
| data=bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), | ||||||||||||||||||||||
| data2=bytes([1, 2, 3, 4, 5]), # second audio channel | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| mock_data_received(protocol, generate_plaintext_packet(response)) | ||||||||||||||||||||||
| await asyncio.sleep(0) | ||||||||||||||||||||||
| assert data_received == 10 | ||||||||||||||||||||||
| assert data2_received == 5 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| response: message.Message = VoiceAssistantAudio( | ||||||||||||||||||||||
| end=True, | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.