Repository navigation
Conversation
|
OpenAI’s realtime PCM format uses 24 kHz, which clients send and expect to work. Instead of rejecting, the audio should be resampled/transcoded, which was noted in the original realtime PR as a follow up at #30636 (review) |
The input rate of a realtime session is 24000 Hz, like OpenAI's audio/pcm, unless session.update sets audio.input.format.rate before the first audio. The server resamples the audio to the model rate with a new mtmd helper that wraps the miniaudio resampler, in transcription and conversation sessions.
| std::vector<float> out; | ||
| }; | ||
|
|
||
| mtmd_helper_resampler * mtmd_helper_resampler_init(int32_t rate_in, int32_t rate_out) { |
There was a problem hiding this comment.
is this even related to this PR?
you said that mismatching sample rate is reject? then why adding a brand new resampler out of nowhere?
There was a problem hiding this comment.
Sorry, my mistake: I pushed the rework with the resampling before explaining it, and the title and description still describe the old change (rejection only).
I added the resampler following @candrews's comment above, which points to @ServeurpersoCom's note in #30636: "24 kHz input with server side resampling, so any OAI client works without knowing the model rate". The server can't call miniaudio directly, since it's compiled into libmtmd as static functions, hence the helper.
Would you rather have resampling, in a new PR or this one reopened, or only the original rejection? And if resampling, is mtmd-helper the right place?
There was a problem hiding this comment.
I suspect this PR is off everyone's radar since it's closed and the title is no longer accurate with the planned change.
I suggest opening a new one.
Overview
Fixes #31696.
A
session.updatewhoseaudio.input.format.rateis not the model's sample rate now gets anerrorevent (audio.input.format.rate must be 16000), and the session keeps its previous settings. Updates that don't set a rate behave as before. The check compares the JSON value itself, so the string"24000"and 16000.5 are rejected too.It also replaces a README note, out of date since #30994, that said held-back words go to the next item.
Requirements