openai / openai-realtime-api-beta

Node.js + JavaScript reference client for the Realtime API (beta)
MIT License
703 stars 177 forks source link

when input format g711_ulaw or g711_alaw, how to use in appendInputAudio? #42

Open fcOSENSE opened 1 month ago

fcOSENSE commented 1 month ago

I assume encodedData.buffer arrayBuffer is ulaw format with 8000hz But when put buffer into appendInputAudio, it cannot get input_audio_transcription.completed event in streaming microphone mode. I found the code mergeInt16Arrays inside appendInputAudio, which should be Uint8Array. client.appendInputAudio(encodedData.buffer); So how to use g711_ulaw on appendInputAudio streaming mode?

K-Mistele commented 1 month ago

The websockets API supports it, but the javascript client does not (it assumes pcm16 is being used). See my comment on #8: https://github.com/openai/openai-realtime-api-beta/issues/8#issuecomment-2411857042