Getting started
Install the cochl Python library, get a project key, and run your first sound event detection, speech analysis, and audio insights request.
Cochl.Sense Pro analyzes pre-recorded audio files for sound events, speech, and high-level scene insights. It accepts MP3, WAV, FLAC, and OGG files, and converts most other audio formats (such as MP4 or M4A) on the server, so you usually don’t need a conversion step.
Cochl.Sense Pro was previously called Cochl.Sense Cloud API.
Prerequisites
- Python 3.10 or higher.
- A Cochl.Sense Dashboard account — sign up or log in at dashboard.cochl.ai. You’ll create a Cochl.Sense Pro project and copy its project key in step 2.
1. Set up your Python environment
Cochl.Sense Pro can be easily integrated into any Python application using the Cochl library. The library supports Python 3.10 or higher. First, create a Python virtual environment.
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install --upgrade cochl
git clone https://github.com/cochlearai/cochl-sense-py.git
cd cochl-sense-py/samplespython -m venv venv
.\venv\Scripts\activate
pip install --upgrade pip
pip install --upgrade cochl
git clone https://github.com/cochlearai/cochl-sense-py.git
cd cochl-sense-py/samplesUse cochl 2.0.2 or later (pip install --upgrade cochl installs the latest). Since 2.0.2 the library sends your project key when it reads a job’s progress stream, which get_completed_result() depends on; older versions don’t.
2. Get your project key
Every request is authenticated with a project key. Sign up or log in at the Cochl.Sense Dashboard, then:
-
Open Projects in the sidebar, click New project, enter a project name, and click Create project. (A new account already has a Default project you can use as is.)
-
Open the project. Its home shows the key under Call it from your app: click the copy icon, or the eye icon to reveal it. The same key is under the project’s Settings, and the Get started button at the top right walks through the first call with code you can run as pasted (Dashboard → Overview).
Don’t share your project key with anyone outside your project or team.
Project keys don’t expire. If you need to rotate one, click Reset key in the project’s Settings on the Dashboard. The new key works right away, and the old one stops working at the same time — update your apps before you reset.
3. Run the example
- Supported file formats for Cochl.Sense Pro: MP3, WAV, FLAC, and OGG. The Dashboard’s service pages (Sound event detection, Speech analysis and Audio insights under Project in the sidebar) take the same four formats, and can also record from your microphone (up to 30 seconds per take) or run one of the built-in sample clips. Through the API and the Python library, files in other formats (for example MP4 or M4A) are converted on the server with FFmpeg; a file that can’t be decoded is rejected with
400(decode failure). - Audio can be up to 59 minutes long per request; a longer file is rejected with
400(audio too long).get_completed_result()waits at most 10 minutes and returnsNoneif the job hasn’t finished by then (the job itself keeps running) — see Rate limits & audio length. Files must be at least 2 seconds long for sound event detection. An organization can have 1 job in progress at a time on the trial and 10 on paid plans; another request meanwhile gets429(REST API → Limits).
If the Dashboard won’t take your file, or the API rejects it as undecodable, convert it first — see Convert to supported file formats.
You can use any audio file of your own. To try it with a ready-made clip, download sample_male_speech.wav into the samples folder you’re in. The cochl-sense-py repository no longer ships audio files on its main branch, so this link points to the commit where the clip was last published (c08a010):
curl -LO https://raw.githubusercontent.com/cochlearai/cochl-sense-py/c08a01060d6a12e25babc2e88bd28b787eb85d65/samples/sample_male_speech.wavOn Windows PowerShell, type curl.exe instead of curl.
This simple setup is enough to upload your file and run analyses. Using the IntegratedApi, you can run sound event detection, speech analysis, and audio insights in a single upload. Replace “YOUR_API_PROJECT_KEY” with your project key.
from cochl.sense import IntegratedApi, IntegratedApiOptions
api = IntegratedApi('YOUR_API_PROJECT_KEY')
job = api.analyze_file(
'sample_male_speech.wav', # or the path to your own file
IntegratedApiOptions(
sound_event_detection=True,
speech_analysis=True,
audio_insights=True,
),
)
result = api.get_completed_result(job['job_id'])
# result['sound_event_detection'] — SED chunks
# result['speech_analysis'] — speech analysis segments
# result['audio_insights'] — audio insights summary
print(result)The same flow ships as a runnable script, sample_audio_insights.py, in the samples folder you cloned. Replace 'YOUR_API_PROJECT_KEY' and 'your_file.wav' in it (for example with 'sample_male_speech.wav'), then run:
python sample_audio_insights.pysample_sound_event_detection.py and sample_speech_analysis.py do the same with a single service enabled.
4. Valid service combinations
The three services are independent: turn on any combination, as long as at least one is on. Turning all three off returns 400 (No services selected).
- Audio insights can run on its own. The server analyzes sound events and speech internally to write the summary, but returns them only if you turn them on too.
- Over the REST API, only sound event detection is on by default; turn on speech analysis and audio insights when you need them (REST API → Options).
- The Python library (
cochl2.0.3) is different: the three service flags ofIntegratedApiOptionsdefault toTrue, soIntegratedApiOptions()runs all three (only sound event detection is billed). PassFalsefor each service you don’t want — for example,IntegratedApiOptions(speech_analysis=False, audio_insights=False)runs sound event detection only.
You’re billed for sound event detection when you turn it on and it succeeds; speech analysis and audio insights are free for now (Usage & pricing).
Sound event detection also takes two optional settings: sound_event_tags returns only the tags you list, and sound_event_thresholds sets a detection threshold per tag (lower catches more, higher catches less). See sound event detection → Keep only some tags and Adjust detection thresholds; the Dashboard sets both under Sound tags in the run settings.
Example response (abbreviated)
An illustrative result for an interview recording, with all three services enabled, shortened to the first few items of each list. It is not the output for sample_male_speech.wav; your values will differ.
{
"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": "Male_speech", "confidence": 0.81 },
{ "class": "Speech", "confidence": 0.94 }
]
},
{
"start_time": "00:01.00",
"end_time": "00:03.00",
"start_time_sec": 1.0,
"end_time_sec": 3.0,
"classes": [
{ "class": "Male_speech", "confidence": 0.88 }
]
}
]
},
"speech_analysis": {
"status": "success",
"results": [
{
"speaker": "SPEAKER_00",
"speaker_name": "Unknown 0",
"speaker_score": 0.08,
"transcript": "So, growing up, your father had a really strong influence on you.",
"start_time": "00:00.00",
"end_time": "00:04.32",
"start_time_sec": 0.0,
"end_time_sec": 4.32
},
{
"speaker": "SPEAKER_01",
"speaker_name": "Christian_Bale",
"speaker_score": 0.41,
"transcript": "Yeah, he taught me to never settle for the obvious choice.",
"start_time": "00:04.60",
"end_time": "00:08.91",
"start_time_sec": 4.6,
"end_time_sec": 8.91
}
]
},
"audio_insights": {
"status": "success",
"result": {
"contains_speech": true,
"detected_language": "en",
"primary_sound_environment": "Speech-dominated, likely an interview",
"situation_summary": "The audio captures an interview where Christian Bale reflects on his father's influence and his approach to acting.",
"notable_events": ["Male_speech", "Speech"],
"speech_content_summary": "Bale credits his father for teaching him to look past obvious choices when picking roles.",
"keywords": ["Christian Bale", "father", "upbringing", "acting"]
}
},
"metadata": {
"audio": {
"input": {
"filename": "interview.wav", "format": "wav", "size_bytes": 5292044,
"sample_rate_hz": 44100, "channels": 2, "content_type": "audio/wav"
},
"processed": {
"sample_rate_hz": 44100, "channels": 1, "encoding": "float32_pcm",
"resampled": false, "downmixed": true
}
},
"warnings": ["Input audio was downmixed to mono before processing."]
}
}A few things to notice:
sound_event_detection.results[]has one entry per 2-second inference window, and a new window starts every second, so windows overlap. Windows where nothing was detected are left out, andclasses[]isn’t sorted by confidence. Don’t add up window durations to measure how long a sound lasted — see sound event detection → How it works.speech_analysis.results[]has one segment per speaker turn — variable length.audio_insights.resultis one object for the whole file (no time chunks).detected_languageis a lowercase ISO 639-1 code ("en", or"en,ko"for several), and is"N/A"when there is no speech.metadatadescribes the audio as received and as processed, and lists anywarnings(for example, resampling, downmixing to mono, aspeech_langthat wasn’t applied, or an input that is nearly silent, very quiet, clipped or recorded below 16 kHz — see Input warnings).metadata.sound_event_model(present when sound event detection is on) names the model that scored the sound events. It’s also the first event on the progress stream.speaker_name: "Christian_Bale"appears because a profile with that name was registered via Custom sound: Speaker profile, andspeaker_scoreis the similarity against that profile. Unmatched turns getUnknown <n>(numbered to match the diarization label inspeaker, e.g.SPEAKER_00→Unknown 0) with the closest profile's score, which is-1.0when the organization has no registered profiles. Organizations without speaker recognition can’t register profiles, so every turn comes back asUnknown <n>— see speech analysis.- Result items also carry identifiers (
idon SED windows and classes,item_idson speech segments and audio insights) used for result feedback. They’re omitted above, and you can ignore them.
Input warnings
While decoding, the API measures the level of your audio and reports it in metadata.audio.level (peak_dbfs, rms_dbfs, active_rms_dbfs, silent_ratio, clipped_ratio). When the input is likely to hurt detection, a plain-language note is added to metadata.warnings. The request still runs.
| You’ll see a warning when | What to do |
|---|---|
| The loudest point of the audio is below −60 dBFS (nearly silent) | Check the recording; few or no sounds can be detected. |
| The loudest point is below −50 dBFS (very quiet) | Record closer to the source or raise the input gain. |
| More than 1% of samples are at full scale (clipped) | Lower the input gain; distortion causes missed or wrong detections. |
| The file was recorded below 16 kHz | Use 16 kHz or higher if you can. |
Time format
Every result item carries both a numeric start_time_sec / end_time_sec (float seconds) and a human-readable start_time / end_time string. The string format is chosen for each value separately, so a long file mixes both:
- Before the 1-hour mark —
MM:SS.SS(e.g."05:32.10"). - From the 1-hour mark on —
HH:MM:SS.SS(e.g."01:01:58.52").
Always parse start_time_sec / end_time_sec for math; the string fields are for display only.
IntegratedApi returns a different (Integration API) result shape than the legacy Client, which was removed in cochl 2.0.2. If you’re migrating older code, see the field mapping under Legacy Client (removed in 2.0.2) in sound event detection.
cochlearai/cochl-sense-py
More runnable sample scripts.
5. Usage & pricing
Cochl.Sense Pro is billed by the length of the analyzed audio. For now only sound event detection is billed; speech analysis and audio insights are free. Length is counted per job by the second, rounded up — a 2.2-second file counts as 3 seconds, a 16-second file as 16.
| Service | Price |
|---|---|
| Sound event detection | $0.012 per minute ($0.0002 per second) |
| Speech analysis | Free |
| Audio insights | Free |
When you combine services in a single request, only sound event detection is billed — all three together cost $0.012 per minute, the same as sound event detection alone. Speech analysis or audio insights on their own cost nothing. Sound event detection that fails (status: "error" in the result) isn’t charged.
The trial includes 20 minutes of audio in total — a one-time allowance, not a monthly one. A finished job counts its full audio length against it, whichever services ran, as long as at least one of them succeeded; a job in which every service failed isn’t counted. On the Free plan, a request whose file would take you past the remaining minutes is rejected up front with 402 (usage limit exceeded) rather than partly processed.
You can review your usage under Usage on the Cochl.Sense Dashboard: minutes per day and per project, and this month’s estimated charge. Before you run a file on a service page, the Dashboard also shows its length and what the run will use. On a project’s home, Minutes this month shows that project’s last 30 days as small bars; clicking them opens Usage filtered to the project. The Dashboard page walks through every menu, including the Request log of your API calls and the History of your runs.
6. Additional notes
(1) Convert to supported file formats (MP3, WAV, FLAC, OGG)
You usually don’t need to: the server converts most other formats for you. Convert a file yourself when the server can’t decode it, or when converting it would take longer than the 120-second limit (decode failure).
Pydub is an easy way to convert audio files into one of the supported formats. First, install Pydub by following the instructions in this link. Then, write a Python script to convert your file, as shown below.
from pydub import AudioSegment
audio = AudioSegment.from_file("sample.mp4", "mp4")
audio.export("sample.mp3", format="mp3")For more details on Pydub, please refer to this link.
Next steps
Sound event detection
Detection details and the result shape.
Speech analysis
Transcribe speech and identify registered speakers.
Audio insights
A single-paragraph summary of the whole file.
Error Codes
Every error the API and the Python library can return.
Not using Python? Pro is a REST API over HTTPS, and the library only wraps it. REST API shows the calls with cURL and Node.js — upload, stream or poll the result, options and limits — and your project’s home on the Dashboard shows the same request with your key filled in under Call it from your app.
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).

