Skip to content
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

Avoid cutting off the beginning of the audio #1008

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

filipi87
Copy link
Contributor

@filipi87 filipi87 commented Jan 16, 2025

An example of signaling using an app message to avoid avoid cutting off the beginning of the audio.

this.botAudio.onplaying = async (event) => {
this.log("onplaying")
this.log("Will send the audio message to play the audio at the next tick")
this.dailyCallObject.sendAppMessage("playable")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "onplaying" event is supposed to trigger only after playback has started (spec here). While it helps, it does not completely solve the issue.

To avoid any audio clipping, if we rely only on this approach, we would still need to add a timeout of at least 1 second before sending the app message.

return
await task.queue_frames(
[
SilenceFrame(duration=0.5),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid adding a timeout on the client side, we are sending a silence frame before the TTSSpeakFrame. During testing, this approach feels more natural and seems to work better than adding a sleep on the client side.

@filipi87 filipi87 requested a review from aconchillo January 16, 2025 21:35
@filipi87 filipi87 changed the title Signalling using app message example Avoid audio clipping example Jan 16, 2025
@filipi87 filipi87 marked this pull request as ready for review January 16, 2025 21:36
@filipi87 filipi87 changed the title Avoid audio clipping example Avoid cutting off the beginning of the audio Jan 20, 2025
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.

1 participant