Remove background noise over WebSocket
Stream raw mono PCM audio and receive denoised audio in the same format and sample rate. Set all options as query parameters on the upgrade request. They cannot change during the session.
A request without valid credentials fails with HTTP 401. A sample_rate or channels
value that is not a valid non-negative integer fails with HTTP 400. While the server restarts, new connections fail with HTTP
503; reconnect with backoff. Any other unsupported parameter value closes the connection with
an invalid_params error frame and close code 1008.
Sessions are limited to 590 seconds. At the limit, the server returns the remaining audio,
sends a max_session_duration error frame, and closes with 1008.
{}{
"type": "end_of_stream"
}{}{
"type": "error",
"code": "invalid_params",
"message": "unsupported sample_rate 96000 (supported: 8000-48000 Hz)"
}Telnyx API v2 Bearer token authentication.
Query parameters passed when opening the WebSocket connection.
Client-to-server binary frame with raw mono PCM audio, in the format and sample_rate
set on the connection. No container and no WAV header.
The frame must contain a whole number of samples (a multiple of 2 bytes for l16,
4 bytes for f32le) and must not exceed 65,536 bytes. 20 ms chunks are a good default.
Client-to-server text frame. Send it when you have no more audio. The server returns all
remaining audio, including the audio held back by the model's processing delay, as one final
binary frame, then closes with code 1000. If you close the connection without it, the end of
your stream is lost. Any other text frame gets an unsupported_message error frame and the
session continues.
Server-to-client binary frame with denoised audio, in the same format and sample_rate as
the input. The model processes fixed-size internal frames and has a short processing delay, so
a frame can be smaller or larger than the matching input frame, or empty. Ignore empty frames. Over the session, total output equals the input length plus the processing delay.
Server-to-client text frame. If the error ends the session, the server closes the connection right after this frame, with the close code listed below and the error code as the close reason.
invalid_params(close1008): a query parameter has an unsupported value.max_session_duration(close1008): the session reached the 590-second limit. The remaining audio is returned first.server_shutdown(close1001): the server is restarting. The remaining audio is returned first. Reconnect with backoff.session_error(close1011): the server could not start the noise suppression session.processing_error(close1011): the noise suppression engine failed.encode_error(close1011): the server could not encode the denoised audio.max_connections(close1013): the server has too many open sessions. Try again later.overloaded(close1013): the server is overloaded and does not accept new sessions. Try again later.chunk_too_large(session continues): the binary frame is larger than 65,536 bytes. The chunk is dropped.decode_error(session continues): the frame length is not a whole number of samples. The chunk is dropped.unsupported_message(session continues): the text frame is not a supported message.
Was this page helpful?
{}{
"type": "end_of_stream"
}{}{
"type": "error",
"code": "invalid_params",
"message": "unsupported sample_rate 96000 (supported: 8000-48000 Hz)"
}