Skip to main content

Cochl Sense

Project description

cochl

cochl is the official Python client library for the Cochl.Sense Cloud API. Use it to detect sound events, transcribe and identify speakers, and summarize what's happening in an audio file, all from Python.

For end-user product documentation see docs.cochl.ai.

Installation

Supported on Python 3.10+.

pip install --upgrade cochl

What's in the library

The library exposes three API classes; pick the one that matches your task.

Class Use for Auth key
IntegratedApi All-in-one analysis: Sound Event Detection + Speech Analysis + Audio Insights in one request. Recommended for new integrations. Project key (X-Api-Key)
Client (also exported as EventDetectionApi) Legacy single-feature client — Sound Event Detection only, with tags[] / probability shape. Kept for v1.x compatibility. Project key (X-Api-Key)
SpeakerProfileApi Register / list / recognize / delete voice profiles used by Speech Analysis. Organization key (X-Org-Key)

Project keys are per-project (Dashboard → Projects → your projectSettings). Organization keys apply across the whole organization (Dashboard → Organization).

Project keys do not expire — rotate them by regenerating from the project's Settings tab.

Samples

Working scripts for each API class live under samples/. Replace the placeholder key and audio file path, then run with python samples/<file>.py.

samples/
├── sample_audio_insights.py        # IntegratedApi — audio_insights=True
├── sample_sound_event_detection.py # IntegratedApi — sound_event_detection=True
├── sample_speech_analysis.py       # IntegratedApi — speech_analysis=True
├── sample_speaker_profile_api.py   # SpeakerProfileApi — register / list / recognize / delete
└── legacy/
    ├── sample.py                   # Legacy Client (v1.x response shape)
    └── config.json                 # Sensitivity / result_summary / tag_filter knobs for Client

Quick start — IntegratedApi

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=True,
        audio_insights=True,
    ),
)

# Block until the job finishes, then return the final result dict.
result = api.get_completed_result(job['job_id'])
print(result)

result is a dict with up to four top-level keys (one per enabled analysis):

  • sense.results[] — Sound Event Detection chunks (~1 s windows) with classes[] (each {class, confidence}) and time fields.
  • speech_analysis.results[] — speaker-turn segments with speaker, speaker_name (when matched against a registered Speaker Profile), transcript, and time fields.
  • audio_insights.result — single object with contains_speech, detected_language, primary_sound_environment, situation_summary, notable_events[], speech_content_summary, keywords[].
  • usageaudio_duration_sec, services_used[], processing_time_ms.

A single upload is capped at 1 hour of audio.

For schema details and per-feature documentation, see:

IntegratedApi accepts MP3, WAV, FLAC, OGG. Convert other formats first — see Convert to supported file formats below.

Valid service combinations

audio_insights is a summary built on top of the other two analyses, so it can't run on its own — enable it only together with both sound_event_detection and speech_analysis. At least one service must be enabled. Invalid combinations come back as 400.

sound_event_detection speech_analysis audio_insights Result
OK — SED only
OK — Speech Analysis only
OK — SED + Speech Analysis
OK — full stack (Dashboard default)
400 — no services selected
400audio_insights requires both SED and Speech Analysis
400audio_insights requires speech_analysis
400audio_insights requires sound_event_detection

Speaker Profiles

Register voices ahead of time so IntegratedApi's Speech Analysis can name them (instead of generic SPEAKER_00 / SPEAKER_01).

from cochl.sense import SpeakerProfileApi

api = SpeakerProfileApi('YOUR_ORGANIZATION_KEY')

# Register a profile from an audio sample.
api.add_new_voice('Anna_Kim', 'anna_sample.wav')

# List every profile registered under this organization.
print(api.list_all_speakers())

# Match speakers in a separate file (uses the registered profiles).
print(api.recognize('meeting.wav'))

# Delete a profile.
api.remove('Anna_Kim')

Notes:

  • Each add_new_voice / recognize upload is capped at 10 MB per file.
  • SpeakerProfileApi uses the organization key (X-Org-Key), not a project key.

See Custom Sound: Speaker Profile for the full registration flow.

Other notes

Convert to supported file formats

Pydub is one easy way to convert audio into a supported format. Install it per the Pydub installation guide, then:

from pydub import AudioSegment

audio = AudioSegment.from_file('sample.mp4', 'mp4')
audio.export('sample.mp3', format='mp3')

For more on Pydub, see the Pydub repo.

Repo layout

This package is published to PyPI from a private development repository (cochl-sense-py-private) and mirrored to the public cochlearai/cochl-sense-py repo for end-user access. Issues and pull requests should be filed against the public mirror.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cochl-2.0.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cochl-2.0.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file cochl-2.0.0.tar.gz.

File metadata

  • Download URL: cochl-2.0.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for cochl-2.0.0.tar.gz
Algorithm Hash digest
SHA256 9042403d690336bc96eb13c1d4ca6a7102c745063d685afa5bb1f4dfad5aaf32
MD5 485217f1170b5bd39ad8afedfd162fe2
BLAKE2b-256 5d1b60038c1ed9f0d7eb0b815a62462552ad08a7b503c6ea6a0b56516b618b5e

See more details on using hashes here.

File details

Details for the file cochl-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: cochl-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for cochl-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc2d9fb392d17c7de6ae2abb24a26a8fbcdf4a437f871aeadfd8efd9e1fd52ae
MD5 966fdb5eddac78fe7406dae398749045
BLAKE2b-256 711ab193af0b02dfe363558d956fcd0a9d53f5e16bfb45cfa92ffb825b1a8030

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page