openai/openai-realtime-api-beta

Issue with client.appendInputAudio

Opened this issue · 3 comments

I am writing the buffer from a Microphone to a file, and also trying to send chunks to the realtime api.

But when I try to send chunks it does not work.

client.appendInputAudio(chunk.buffer);

I do make sure to call client.createResponse(); when I'm ready, but the model responds as if I have sent nothing.

Chunk is a Buffer object and chunk.buffer is the underlying ArrayBuffer.

However, I can write chunk to a file, and send the whole file without a problem with:

client.sendUserMessageContent([{type:"input_audio", audio:toArrayBuffer(binaryData)}]);

Where binaryData is the result of fs.readFileSync(filePath); on the file I have just written the chunks to, and toArrayBuffer converts that binary data of that file to array buffer using this package ( https://www.npmjs.com/package/to-array-buffer )

Are you using g.711 u-law audio? If so, see my comment on #8: #8 (comment)

i have similar issue

Screenshot 2024-12-16 at 4 56 20 PM doing this seem to be working for me