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

Add Example of playing the audio received from p:openai_realtime_dart #609

Open
oliverbytes opened this issue Dec 5, 2024 · 2 comments
Open
Labels
p:openai_realtime_dart openai_realtime_dart package t:documentation Improvements or additions to documentation

Comments

@oliverbytes
Copy link

Issue with current documentation:

Can someone please give an example on how to play the received audio file? I'm using just_audio and passed the Uint8list bytes as the source but it's playing like a noise output instead of the actual voice response. My code below

client.on(RealtimeEventType.conversationItemCompleted, (event) async {
    final item = (event as RealtimeEventConversationItemCompleted).item;
    final audio = item.formatted!.audio;
    await player.setAudioSource(AudioBytesSource(audio));
    await player.play();
  });

Idea or request for content:

No response

@oliverbytes oliverbytes added the t:documentation Improvements or additions to documentation label Dec 5, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in LangChain.dart Dec 5, 2024
@oliverbytes oliverbytes changed the title Add Example of playing the audio received from openai_realtime_dart Add Example of playing the audio received from p:openai_realtime_dart Dec 5, 2024
@davidmigloz davidmigloz added the p:openai_realtime_dart openai_realtime_dart package label Dec 6, 2024
@davidmigloz
Copy link
Owner

Hey @oliverbytes,

The audio format is raw 16 bit PCM audio at 24kHz, 1 channel, little-endian.
I know people using flutter_sound to play it.

I don't have a concrete example at the moment, but if anyone can send a PR with one that would be great.

@oliverbytes
Copy link
Author

flutter_sound

Thank you very much, I'll try this! And I hope the example will be included soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:openai_realtime_dart openai_realtime_dart package t:documentation Improvements or additions to documentation
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants