Sound event detection
Detect 100+ sound events per time window in uploaded audio files with Cochl.Sense Pro and the IntegratedApi Python client.
Sound event detection (SED) identifies the sound events present in an audio file—sirens, gunshots, baby cries, glass breaks, and over 100 other categories. SED is the core capability of Cochl.Sense and is available in both Cochl.Sense Pro and Cochl.Sense Core.
This page covers SED via Cochl.Sense Pro. For on-device detection, see Cochl.Sense Core → sound event detection.
1. How it works
When you upload a file, the API runs a sliding-window classifier and returns the detected events per window. With the standard model, each window is 2 seconds long and a new window starts every second, so consecutive windows overlap by 1 second (0–2 s, 1–3 s, 2–4 s, …). For each window, the API returns the time interval and the sound classes whose confidence passed that tag’s detection threshold.
- A window in which no class passed its threshold is left out of the results, so the list can have gaps.
- A trailing piece of audio shorter than a full window isn’t analyzed, and a file shorter than one window (2 s) can’t be analyzed at all — the service returns an error (details).
- Because windows overlap, don’t add up window durations to estimate how long a sound lasted — a 3-second siren shows up in about four 2-second windows.
Pick the tags, and how sensitive each one is
You don’t have to take every tag at its default. In each request you can keep only the tags you need (sound_event_tags) and set a detection threshold per tag (sound_event_thresholds): a lower threshold catches more of a sound, a higher one catches less. Both work from the Dashboard and from the API — see Keep only some tags and Adjust detection thresholds.
The model recognizes 100+ tags across eight categories. The example above shows Speech detection; the full catalog covers everything from sirens and gunshots to vacuum cleaners and bird chirps. A taste of what each category covers:
Emergency
Siren · Gunshot · Glass_break
Human action
Applause · Clap · Footstep
Human status
Baby_cry · Cough · Snore
Human speech
Speech · Whisper · Yell
Home context
Vacuum_cleaner · Knock · Cooking
Outdoor context
Car_horn · Car_alarm · Aircraft_noise
Animal
Dog_bark · Cat_meow · Bird_chirp
Music
Guitar · Piano · Drum
Browse all
100+ tags →
For the complete list, see Sound tags.
2. Detecting sound events with Python
Use cochl.sense.IntegratedApi—the multi-feature client. It returns SED in the unified Integration API shape (classes[] / confidence), and can run speech analysis and audio insights in the same call.
The older single-feature cochl.sense.Client (SED-only, legacy tags[] / probability shape) was removed in cochl 2.0.2. On the current library, from cochl.sense import Client raises ImportError. If you still have Client code, see Legacy Client (removed in 2.0.2) below for the migration mapping.
Make sure you’ve completed Getting started—you need a project key and the cochl Python library installed.
from cochl.sense import IntegratedApi, IntegratedApiOptions
api = IntegratedApi('YOUR_API_PROJECT_KEY')
job = api.analyze_file(
'your_file.wav',
IntegratedApiOptions(
sound_event_detection=True,
speech_analysis=False, # the service flags default to True,
audio_insights=False, # so turn off the ones you don't want
),
)
result = api.get_completed_result(job['job_id'])
for chunk in result['sound_event_detection']['results']:
# classes[] isn't sorted by confidence — pick the highest yourself
top = max(chunk['classes'], key=lambda c: c['confidence'])
print(f"[{chunk['start_time_sec']:.2f}–{chunk['end_time_sec']:.2f}] "
f"{top['class']} ({top['confidence']:.2f})")Running this on a short baby-monitor clip prints something like:
[0.00–2.00] Baby_cry (0.92)
[1.00–3.00] Baby_cry (0.88)
[2.00–4.00] Speech (0.74)
[3.00–5.00] Speech (0.81)
[5.00–7.00] Baby_cry (0.61)There is no 4.00–6.00 line: nothing in that window passed its threshold, so the API left it out.
And the result dict it came from:
{
"sound_event_detection": {
"status": "success",
"results": [
{
"start_time": "00:00.00",
"end_time": "00:02.00",
"start_time_sec": 0.0,
"end_time_sec": 2.0,
"classes": [
{ "class": "Speech", "confidence": 0.41 },
{ "class": "Baby_cry", "confidence": 0.92 }
]
},
{
"start_time": "00:01.00",
"end_time": "00:03.00",
"start_time_sec": 1.0,
"end_time_sec": 3.0,
"classes": [
{ "class": "Baby_cry", "confidence": 0.88 }
]
}
]
}
}classes lists only the tags that passed their thresholds, in the model’s tag order rather than by confidence — the first entry isn’t necessarily the most confident one. The result also carries a top-level metadata object and an id on each window and class; see Getting Started → Example response.
Set speech_analysis=True in the same IntegratedApiOptions call to also transcribe speech, or audio_insights=True to add a summary. Speech analysis and audio insights are free for now — see Getting Started → Valid service combinations and Usage & pricing.
Keep only some tags
If you only care about a few sounds, list them in sound_event_tags and the result keeps just those tags. Use the exact names from Sound tags; they are case-sensitive.
options = IntegratedApiOptions(
sound_event_detection=True,
speech_analysis=False,
audio_insights=False,
)
options.sound_event_tags = ['Glass_break', 'Scream'] # only these tags in the result
job = api.analyze_file('your_file.wav', options)Over plain HTTP, add the same key to the options JSON: {"sound_event_detection": true, ..., "sound_event_tags": ["Glass_break", "Scream"]}.
- The model still analyzes every tag, so the cost is the same and audio insights still sees every sound. Only the
sound_event_detectionresult is filtered. - A window with none of your tags is left out, like any window where nothing passed its threshold, so
classesis never empty. - A name the model doesn’t know returns
400with a suggestion, for exampleGlass_brake (did you mean Glass_break?)(details). Leavesound_event_tagsout to get every tag.
On the Dashboard: on the Sound event detection page, click Choose tags next to Sound tags, pick the tags and click Done. The Run this from your code panel under the result (also Export → Get code) then shows the same request with sound_event_tags filled in.
Adjust detection thresholds
Every tag has a default detection threshold: a window reports the tag only when its confidence is above it. To catch more of a sound, lower its threshold; to catch less, raise it. Change it per request with sound_event_thresholds; tags you don’t list keep their defaults.
options.sound_event_thresholds = {'Glass_break': 0.3, 'Speech': 0.8}The defaults depend on the model your project uses, so read them from the API rather than hard-coding them:
curl -s https://integration.cochl.ai/api/v1/tags -H "X-Api-Key: $COCHL_KEY"
# {"model": "...", "tags": [{"name": "Glass_break", "threshold": 0.5}, ...]}Each result names the model in metadata.sound_event_model. When your project moves to a new model, its defaults can change, so review any thresholds you set. Values must be between 0 and 1, and an unknown tag name returns 400 with a suggestion (details).
On the Dashboard: on the Sound event detection page, click Edit next to Sensitivity, pick a tag and enter its threshold (0 to 1); the box starts at the tag’s default for your project’s model. Run this from your code includes the thresholds as sound_event_thresholds.
cochlearai/cochl-sense-py
More runnable sample scripts.
The original single-feature cochl.sense.Client returned SED-only results in the legacy tags[] / probability shape. It was removed in cochl 2.0.2, together with APIConfig and APIConfigFromJson; the last version that includes it is 2.0.1 (pip install "cochl==2.0.1"). Move to IntegratedApi. The snippet below is only here to help you recognize and migrate old code:
import cochl.sense as sense
from cochl.sense import Result
api_config = sense.APIConfigFromJson('./config.json')
client = sense.Client(
'YOUR_API_PROJECT_KEY',
api_config=api_config,
)
result: Result = client.predict('your_file.wav')
print(result.events.to_dict(api_config))to_dict() returns the session id and one entry per window, with times as float seconds:
{
"session_id": "df1637ab-5478-455c-bff8-c7b90ff215c2",
"window_results": [
{
"start_time": 3.0,
"end_time": 5.0,
"sound_tags": [
{ "name": "Baby_cry", "probability": 0.92 }
]
}
]
}For a summarized, human-readable form, events_summarized() merges consecutive windows per tag and returns a string, one line per detection (for example At 3.0-7.0s, [Baby_cry] was detected):
print(result.events_summarized(api_config))Migrating to IntegratedApi — the field rename pattern:
Legacy Client shape | Integration API shape |
|---|---|
window_results[] (one per window) | sound_event_detection.results[] (one per window that has a detection) |
window_results[].sound_tags[].name | results[].classes[].class |
window_results[].sound_tags[].probability | results[].classes[].confidence |
start_time / end_time (float seconds) | start_time_sec / end_time_sec (float seconds), plus display strings start_time / end_time (MM:SS.SS, or HH:MM:SS.SS from the 1-hour mark) |
session_id | job_id (returned by analyze_file) |
events_summarized() (a string) | No equivalent — build your own summary from results[] |
3. Training your own sound events
Cochl.Sense Pro uses our built-in tag list only. If you need to train a custom sound tag, that’s available exclusively on Cochl.Sense Core—see Cochl.Sense Core → Custom sound: Sound events.
Cochl.Sense Pro supports a different kind of customization—Custom sound: Speaker profile, for identifying specific voices in speech analysis results.
4. Combine with other analyses
On the Dashboard, each service has its own page and runs on its own: the Sound event detection page runs SED only, and the Audio insights page runs audio insights only. To run SED in the same request as speech analysis or audio insights, use the API or the Python library. Only sound event detection is billed, and only if it succeeds; speech analysis and audio insights are free for now (see Usage & pricing); through the API you can turn on any combination of the three, for example, sound event detection and audio insights without speech analysis (Valid service combinations).
On the Sound event detection page, the result has two tabs:
- Sound Events—per-window timeline and per-tag detections
- JSON—the full result as returned by the API
The Export menu above the result copies the JSON (Copy JSON), downloads it (Result (JSON)) or the detections as a spreadsheet (Sound Events (CSV)), and opens Get code, the same request for your own code.
Last updated
Need help? Contact support@cochl.ai
For Cochl.Sense Pro, include the job_id and the time of the request (with time zone).

