-
Notifications
You must be signed in to change notification settings - Fork 2
Add commands for user audio control: mute, unmute, and start with user audio muted. #23
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
Conversation
Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
df59cb4 to
7162b55
Compare
|
Require refactor of the stream api command function, too many nested ifs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds mute functionality to the mod_openai_audio_stream module, allowing selective control of audio flow between the caller and OpenAI Realtime API. It introduces the ability to start with the user muted and provides runtime controls to mute/unmute either the user's audio going to OpenAI, OpenAI's audio playing to the user, or both.
Key changes:
- Added
user_audio_mutedandopenai_audio_mutedflags to control audio flow independently - Implemented
muteandunmuteAPI commands with support for targeting specific audio directions - Introduced
start_mutedparameter to allow initializing sessions with user audio muted - Changed default sampling rate from 8kHz to 24kHz to align with OpenAI Realtime API requirements
- Replaced C-style casts with
static_castandreinterpret_castthroughout for better type safety
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| openai_audio_streamer_glue.h | Added function declarations for mute control and updated stream_session_init signature to accept start_muted parameter |
| openai_audio_streamer_glue.cpp | Implemented mute logic, replaced C-style casts with C++ casts, added handling for speech_stopped events, removed unused variable, and integrated mute state into audio streaming logic |
| mod_openai_audio_stream.h | Added user_audio_muted and openai_audio_muted bit fields to private_data struct |
| mod_openai_audio_stream.c | Added do_audio_mute function, mute/unmute API commands, updated default sampling to 24kHz, and added mute_user initialization flag handling |
| README.md | Updated documentation to describe new mute/unmute commands and clarified behavior of pause/resume commands |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
a0ec65a to
eba0a45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eba0a45 to
f362a43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f362a43 to
239ddf2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
) Not flushing audio buffer caused a delayed response upon unmute (caused by releasing old buffered user audio). Not sending an empty chunk of audio would not trigger model inference when user speech gets interrupted by mute. Also check pr #23 for more details Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
239ddf2 to
747c123
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
mod_openai_audio_stream.c:1
- Double semicolons at the end of these declarations should be single semicolons.
/*
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
747c123 to
468fe2c
Compare
) Not flushing audio buffer caused a delayed response upon unmute (caused by releasing old buffered user audio). Not sending an empty chunk of audio would not trigger model inference when user speech gets interrupted by mute. Also check pr #23 for more details Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
) Not flushing audio buffer caused a delayed response upon unmute (caused by releasing old buffered user audio). Not sending an empty chunk of audio would not trigger model inference when user speech gets interrupted by mute. Also check pr #23 for more details Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
468fe2c to
129d7cd
Compare
No description provided.