Closed davidvonthenen closed 1 month ago
The pull request introduces modifications to several interfaces and classes within the Deepgram.Clients
namespace. Key changes include the addition of a bool nullByte
parameter, defaulting to false
, in the Stop
and Close
methods of the IListenWebSocketClient
and ISpeakWebSocketClient
interfaces, as well as in the corresponding Client
classes. These changes enhance the functionality of these methods by allowing more control over the WebSocket connection closure process. Additionally, the Program.cs
file in the examples
directory has been updated to handle audio output in WAV format, including the addition of a WAV header.
File | Change Summary |
---|---|
Deepgram/Clients/Interfaces/v1/IListenWebSocketClient.cs | Updated Stop method signature to include bool nullByte = false . |
Deepgram/Clients/Interfaces/v1/ISpeakWebSocketClient.cs | Updated Stop method signature to include bool nullByte = false and Close method signature to include bool nullByte = false . |
Deepgram/Clients/Listen/v1/WebSocket/Client.cs | Updated Stop method signature to include bool nullByte = false and modified internal logic to handle closing via SendClose(nullByte) and added a delay for processing before closing. |
Deepgram/Clients/Speak/v1/WebSocket/Client.cs | Updated Close method signature to include bool nullByte = false and modified Stop method to call updated Close . Streamlined close message sending logic and added logging enhancements. |
examples/text-to-speech/websocket/simple/Program.cs | Added bool appendWavHeader variable and modified audio output handling to write a WAV header and change output file format from MP3 to WAV, initializing SpeakSchema with Encoding set to "linear16" and SampleRate set to 48000. |
ISpeakWebSocketClient
interface has been modified to include a Stop
method with an additional bool nullByte
parameter, similar to the changes made in the IListenWebSocketClient
interface in the main PR.ISpeakWebSocketClient
interface's Send
, SendMessage
, and SendMessageImmediately
methods have been updated to include an optional length
parameter, which aligns with the enhancements made to the Stop
method in the main PR.WebSocketMessage
class in both the Listen
and Speak
namespaces has been updated to improve buffer length handling, which relates to the overall message handling improvements seen in the main PR's changes to the Stop
method.Client
class for both Listen and Speak functionalities include improved error handling and connection checks, which are relevant to the modifications made to the Stop
method in the main PR.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?
Completion
Proposed changes
Address: https://github.com/deepgram/deepgram-dotnet-sdk/issues/341
The
Stop()~ function has been changed to no longer use cancel to trigger the stop, but to fire the
Close` message with a small delay, does a "best effort" to allow any final transcription to get passed back to the client.This also changes the TTS WS example to use linear16 which is more inline with examples in other SDKs.
Types of changes
What types of changes does your code introduce to the community .NET 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