Skip to content

Conversation

@dariopellegrino00
Copy link
Collaborator

No description provided.

Signed-off-by: Dario Pellegrino <dario.pellegrino@voismart.it>
@dariopellegrino00 dariopellegrino00 self-assigned this Oct 30, 2025
@dariopellegrino00 dariopellegrino00 force-pushed the feature/user-audio-flow-control branch from df59cb4 to 7162b55 Compare October 30, 2025 18:10
@dariopellegrino00
Copy link
Collaborator Author

Require refactor of the stream api command function, too many nested ifs

Copy link
Contributor

Copilot AI left a 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_muted and openai_audio_muted flags to control audio flow independently
  • Implemented mute and unmute API commands with support for targeting specific audio directions
  • Introduced start_muted parameter 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_cast and reinterpret_cast throughout 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>
@dariopellegrino00 dariopellegrino00 force-pushed the feature/user-audio-flow-control branch from a0ec65a to eba0a45 Compare October 30, 2025 22:54
Copy link
Contributor

Copilot AI left a 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.

@dariopellegrino00 dariopellegrino00 force-pushed the feature/user-audio-flow-control branch from eba0a45 to f362a43 Compare November 3, 2025 13:53
Copy link
Contributor

Copilot AI left a 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.

@dariopellegrino00 dariopellegrino00 force-pushed the feature/user-audio-flow-control branch from f362a43 to 239ddf2 Compare November 3, 2025 14:00
Copy link
Contributor

Copilot AI left a 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.

dariopellegrino00 added a commit that referenced this pull request Nov 3, 2025
)

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>
@dariopellegrino00 dariopellegrino00 force-pushed the feature/user-audio-flow-control branch from 239ddf2 to 747c123 Compare November 3, 2025 16:31
Copy link
Contributor

Copilot AI left a 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>
@dariopellegrino00 dariopellegrino00 force-pushed the feature/user-audio-flow-control branch from 747c123 to 468fe2c Compare November 3, 2025 16:40
dariopellegrino00 added a commit that referenced this pull request Nov 3, 2025
)

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>
@dariopellegrino00 dariopellegrino00 force-pushed the feature/user-audio-flow-control branch from 468fe2c to 129d7cd Compare November 3, 2025 16:44
@dariopellegrino00 dariopellegrino00 marked this pull request as ready for review November 3, 2025 18:01
@dariopellegrino00 dariopellegrino00 merged commit 69a5b75 into develop Nov 3, 2025
2 checks passed
@dariopellegrino00 dariopellegrino00 deleted the feature/user-audio-flow-control branch November 3, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants