[Realtime API] Audio is randomly cutting off at the end

@gokulraya do you please have an update on this matter?

It seems to effect practically everyone…

4 Likes

I was experiencing the same problem while preparing the demo code for my simple-openai Java library. I was able to fix it, after a brief analysis:

  1. After speaking, my code sends a response.create request.
  2. The AI ​ ​sends audio fragments via several response.audio.delta events and sends a response.audio.done event when it finishes.
  3. My code handles those two types of events: it plays each audio delta and stops the speakers when a done audio arrives.
  4. Because handling audio deltas takes more time, it might be necessary to give a little delay before stopping the speakers. This solved the problem.

Here you can see the code that shows how it works:

You should be able to extrapolate this fix to your own language/framework.

I will revisit this but if you check in the thread we already tried some of us this. It seems to still not work. It really look like the audio never arrives so no fix possible on client side.

Here: [Realtime API] Audio is randomly cutting off at the end - #13 by robertgr

but as I wrote later, that didn’t quite fix it. I was just coincidentally not reproducing. Did you try enough times to be sure it is not happening in your case? this is anyway happening?

@robertgr The problem occurred consistently and after the fix it did not happen consistently anymore.

It is worth mentioning that my code is at the backend level calling the Realtime API.

1 Like

This is incredibly frustrating. I hope the OpenAI developers are aware of this issue. I’ve been working on something for months, and now I’m just waiting to deploy it to production once the audio interruptions are resolved.

1 Like