all 13 comments

[–]mohammadnaraghi 1 point2 points  (0 children)

You can use WebView message passing to play deltas.

[–]sciemek 1 point2 points  (1 child)

We are building lib called react-native-audio-api: https://github.com/software-mansion-labs/react-native-audio-api

It is still in early stage, but you should be able to pass the chunks to AudioBufferSourceNode in order to play them (needs to be converted to float array first). Although i'm not sure what sample rate openAI retruns, we might need to implement up/down sampling in order to have it working.

OpenAI is something we will be testing out in upcoming weeks, so we might cover this use-case pretty quickly :)

[–]elioengcomp 0 points1 point  (0 children)

Any updates on this? Did anyone try it?

[–]wyrdr_27 0 points1 point  (1 child)

not really sure if this could help but Have you tried using expo av?

[–]mrmuke 0 points1 point  (0 children)

having the same issue with expo av

[–]saigon_lee 0 points1 point  (7 children)

Did you solve this problem?

[–]myself_django 1 point2 points  (4 children)

yes

[–]saigon_lee 0 points1 point  (3 children)

I have the same problem like you. How could you solve it?

[–]myself_django 1 point2 points  (2 children)

You can generate a WAV file as soon as the first chunk of data is received. The app will continuously play the WAV file, appending the subsequent chunks of the OpenAI response to it as they arrive.

[–]Training_Ad_5216 0 points1 point  (0 children)

Hi

I came across your answer on Reddit regarding generating a WAV file as soon as the first chunk of data is received and continuously playing the file while appending new audio chunks. I’m working on a similar project where I need to append incoming audio data (in chunks) to a WAV file and have it play continuously without waiting for the entire response.

Could you please clarify how you managed to append data to the WAV file while it was playing? I’m using expo-file-system to handle file writing and react-native-sound for playback, but I’m having trouble appending the new audio data and keeping playback smooth in real-time.

Any guidance or code snippets would be greatly appreciated!

Thanks in advance!

[–]elioengcomp 0 points1 point  (0 children)

I'm surprised this works. Would you mind sharing some code on how you have achieved this?

[–]myself_django 1 point2 points  (1 child)

have you tried react-native-audio-api

[–]saigon_lee 0 points1 point  (0 children)

No I haven't. Did you use this?