Skip to main content
The Music & Speech Detection streaming API classifies audio as music, speech, or neither, returning frame-level probabilities progressively as audio arrives over WebSocket.

Connect and stream

1

Authenticate

Pass your API key as a query parameter on the connection URL. Unlike the batch endpoints, there is no X-API-Key header.
See Authentication and rate limits for how to obtain a key.
2

Choose your audio format

Set audio_format to match what you’re sending.Container formats (no sample_rate or num_channels needed): wav, mp3, ogg, flac, webm, aac, aiffRaw PCM formats (sample_rate and num_channels required): s16le, s16be, s32le, s32be, f32le, f32be, and others — see the API reference for the full list.
3

Stream audio and read frames

Send audio as binary WebSocket frames in any chunk size. The server emits a frame message after each 192ms of audio processed:
Music and speech probabilities are independent — both can be high simultaneously (e.g. music with vocals).
4

Signal end of stream

Send an empty text frame ("") when you’re done sending audio. The server will flush any remaining audio and respond with a done message:

Code examples

WebSocket APIs cannot be tested with cURL. For command-line testing, use websocat.

Next steps