Skip to main content
Music & Speech Detection classifies what kind of sound is present across a clip: music, speech, both, or neither. Common uses are skipping hold music, gating a pipeline so only speech is processed downstream, and locating where a broadcast switches between talk and track. music_prob and speech_prob are independent, not a split of 100%. A singer over a backing track scores high on both at once. This is not AI Music Detection, which answers whether music was model-generated. See AI Music Detection.

Music & Speech Detection (batch)

Returns application/json. Every field is always present. Note that duration here is duration_s in seconds. Most other Modulate endpoints report duration_ms.

Try it

Output
frames is abridged above. A 5.76 second clip returns all 30 of its 192 ms frames.

What you can configure

Audio formats

Accepted extensions include .mp3, .wav, .flac, .m4a, .mp4, .ogg, .opus, .webm, .aac, .aiff, and .mov, plus 85 others.
.3g2, .3ga, .3gp, .3gpp, .8svx, .aa3, .aac, .ac3, .act, .adts, .aif, .aifc, .aiff, .alac, .amb, .amr, .ape, .asf, .at3, .au, .avi, .avr, .awb, .bwf, .c2, .caf, .dss, .dts, .dtshd, .eac3, .ec3, .f4a, .f4b, .flac, .flv, .gsm, .iff, .m2a, .m2ts, .m4a, .m4b, .m4r, .m4v, .mka, .mkv, .mlp, .mmf, .mov, .mp+, .mp1, .mp2, .mp3, .mp4, .mpa, .mpc, .mpeg, .mpg, .mpga, .mpp, .mts, .mxf, .nist, .oga, .ogg, .ogx, .oma, .omg, .opus, .paf, .pvf, .qcp, .ra, .rf64, .rka, .rm, .rmvb, .sf, .shn, .snd, .sph, .svx, .tak, .thd, .ts, .tta, .vob, .voc, .vqf, .w64, .wav, .wave, .weba, .webm, .wma, .wmv, .wv
Maximum file size is 100 MB. Empty files are rejected with 400.

Music & Speech Detection (streaming)

One frame message per completed 192 ms window, then a done message carrying clip totals computed across everything received. Note that done reports duration_ms in milliseconds, where the batch response reports duration_s in seconds. Send audio as binary WebSocket frames of any size; the server buffers and windows internally. Send an empty text frame ("") to end the stream. The server then flushes remaining audio, delivers final frames, sends done, and closes.

Try it

Output
One frame line is printed per 192 ms of audio, so a 15 second clip prints 80 of them before done.
A stream ends with an empty text frame. A shell pipe sends binary frames only, so curl and websocat cannot close a stream cleanly. Use one of the clients above.

What you can configure

Audio formats

audio_format is required on every connection, including self-describing containers. Omitting it closes the connection with code 1003.
Container formats. Accepted values include mp3, wav, flac, m4a, mp4, ogg, opus, webm, aac, aiff, wma, amr, and au, plus 66 others. The stream header carries sample rate and channel count, so sample_rate and num_channels are ignored if supplied.
3g2, 3ga, 3gp, 3gpp, 8svx, aa3, aac, ac3, act, adts, aif, aifc, aiff, amb, amr, asf, at3, au, avr, awb, bwf, c2, caf, dss, dts, dtshd, eac3, ec3, f4a, f4b, flac, gsm, iff, m2a, m2ts, m4a, m4b, m4r, m4v, mka, mkv, mlp, mp+, mp1, mp2, mp3, mp4, mpa, mpc, mpga, mpp, mts, oga, ogg, ogx, oma, omg, opus, paf, pvf, qcp, ra, rf64, rm, rmvb, snd, svx, thd, ts, tta, voc, vqf, w64, wav, wave, weba, webm, wma, wmv
The MP4-family values (mp4, m4a, m4b, m4r, m4v, 3gp, 3gpp, 3ga, 3g2, f4a, f4b) must be sent in a streamable layout. Anything else ends the connection with an audio-processing error. Raw formats. s8, s16le, s16be, s24le, s24be, s32le, s32be, u8, u16le, u16be, u24le, u24be, u32le, u32be, f32le, f32be, f64le, f64be, mulaw, alaw, g722, vox. These are headerless, so sample_rate and num_channels are both required. g722 and vox are mono-only: num_channels must be 1. sample_rate accepts 8000, 11025, 16000, 22050, 32000, 44100, 48000, 96000. Common raw configurations: To convert a file to raw PCM:
Format parameters are validated at connection time, closing with 1003, and again while decoding, closing with 4002. The second catches undecodable audio and a mismatch between the declared audio_format and the bytes sent.

API reference