Closed davidvonthenen closed 1 month ago
The pull request introduces enhancements across multiple classes related to audio processing. The Microphone
class now supports improved audio stream initialization and state management, including a new method for checking the muted state. The Speaker
class integrates microphone control, allowing for better synchronization during audio playback. Logging mechanisms in websocket client classes are fortified to prevent errors. Additionally, example scripts for text-to-speech have been updated for better audio data handling and connection management, with some features removed for simplification.
File Path | Change Summary |
---|---|
deepgram/audio/microphone/microphone.py |
Updated Microphone class to improve audio stream initialization and state management. Added is_muted method and logging enhancements. |
deepgram/audio/speaker/speaker.py |
Enhanced Speaker class to support microphone control. Added _microphone attribute and wait_for_complete_with_mute method. |
deepgram/clients/common/v1/abstract_async_websocket.py |
Modified finish method to enhance logging by checking thread object before accessing its name . |
deepgram/clients/common/v1/abstract_sync_websocket.py |
Updated finish method for improved logging robustness with checks for thread before accessing its name . |
deepgram/clients/speak/v1/websocket/async_client.py |
Added support for microphone in AsyncSpeakWSClient with a new optional parameter and improved initialization logic. |
deepgram/clients/speak/v1/websocket/client.py |
Updated SpeakWSClient to support microphone input with new optional parameter and improved cleanup in the finish method. |
examples/text-to-speech/websocket/output_to_wav/main.py |
Modified to include wave module and AUDIO_FILE constant. Simplified audio data handling and event management. |
examples/text-to-speech/websocket/simple/main.py |
Removed wave module and file handling. Updated DeepgramClient configuration and added new event handlers for websocket management. |
deepgram/clients/common/v1/abstract_async_rest.py |
Added error handling in _handle_request method to check for None responses and raise DeepgramError . |
deepgram/clients/common/v1/abstract_sync_rest.py |
Introduced error handling in _handle_request method to ensure response validity and raise DeepgramError if conditions are not met. |
deepgram/clients/listen/v1/helpers.py |
Deleted file containing utility functions for URL manipulation: append_query_params and convert_to_websocket_url . |
deepgram/clients/speak/v1/websocket/helpers.py |
Deleted file containing utility functions for URL manipulation: append_query_params and convert_to_websocket_url . |
examples/speech-to-text/websocket/replay/main.py |
Added new file implementing speech-to-text functionality using Deepgram SDK, with websocket connection and transcription processing. |
wait_for_complete
method in the Speaker
class is directly related to the changes in the Microphone
class, as both involve managing audio playback and state.Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Proposed changes
This ports enhancements from the Agent EA work that is happening. Since that work will probably take some time to get to GA, backporting the things I can.
Changes:
is_muted
call on the Microphonewait_for_complete_with_mute
call on the SpeakerTypes of changes
What types of changes does your code introduce to the community Python SDK? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
NA
Summary by CodeRabbit
New Features
Bug Fixes
Documentation