Skip to content
Speech analysis

Speech analysis

Transcribe speech, detect its language, and label who said what, including registered speakers, with Cochl.Sense Pro.

Speech analysis turns the speech in an uploaded audio file into structured data—what was said and who said it. It has two capabilities working together:

  • Transcription—speech to text, segmented by speaker turn.
  • Speaker profile—populates speaker_name with a registered name when the voice matches a Custom sound: Speaker profile you’ve registered. Voices that don’t match a profile get Unknown 0, Unknown 1, … instead, numbered to match the diarization label in speaker (SPEAKER_00, SPEAKER_01, …). Registering profiles needs speaker recognition to be enabled for your organization — see When every speaker is Unknown.

Speech analysis is available on Cochl.Sense Pro projects only.

1. Transcription output

Transcription returns one segment per uninterrupted speaker turn. A 30-second clip with two speakers trading off might produce ten segments of varying length, not 30 one-second chunks. Inside the Integration API response it appears under the speech_analysis key:

{
  "speech_analysis": {
    "status": "success",
    "results": [
      {
        "speaker": "SPEAKER_00",
        "speaker_name": "Unknown 0",
        "speaker_score": 0.08,
        "transcript": "I've never enjoyed challenging high-profile roles.",
        "start_time": "00:00.00",
        "end_time": "00:05.27",
        "start_time_sec": 0.0,
        "end_time_sec": 5.27
      },
      {
        "speaker": "SPEAKER_01",
        "speaker_name": "Christian_Bale",
        "speaker_score": 0.41,
        "transcript": "But the directing pulled me in.",
        "start_time": "00:05.34",
        "end_time": "00:07.91",
        "start_time_sec": 5.34,
        "end_time_sec": 7.91
      }
    ]
  }
}
FieldMeaning
speakerDiarization label (SPEAKER_00, SPEAKER_01, …). Stable within a single file; not stable across files.
speaker_nameRegistered profile name when this voice matches a Custom sound: Speaker profile. Otherwise Unknown <n>, where <n> is the number in the speaker label (SPEAKER_01 → Unknown 1). Present when the speaker_profile option is on (the Python library turns it on together with speech analysis); otherwise the segment has speaker only.
speaker_scorePresent together with speaker_name: the similarity between this voice and the closest registered profile, as a number rounded to three decimals (higher is more confident). Unknown segments carry a score too — the closest profile just didn’t score high enough — and it is -1.0 when the organization has no registered profiles.
transcriptThe recognized text for this turn.
start_time, end_timeSegment boundaries as a string — MM:SS.SS, or HH:MM:SS.SS for times from the 1-hour mark on. For display only.
start_time_sec, end_time_secSegment boundaries in seconds (float). Use these for math.

Segments carry no language field; the spoken language is reported once per file by audio insights (see Supported languages). Each segment also has an item_ids object (identifiers used for result feedback), which you can ignore.

When every speaker is Unknown

Turns that match no registered profile get Unknown 0, Unknown 1, … in speaker_name, with the closest profile’s score in speaker_score (-1.0 when your organization has no profiles). Registering profiles needs speaker recognition to be enabled for your organization; contact support@cochl.ai to have it turned on. speaker_name and speaker_score are left out when speaker_profile is off.

On the Dashboard’s Speech analysis page, those segments appear in the result’s Speech analysis tab as a scrollable log with per-speaker color coding. Clicking a segment seeks the audio player to that point.

Speech analysis transcript view in the Dashboard

2. Supported languages

Transcription detects the spoken language automatically. The speech_lang option is no longer applied: if you send a language code other than multi, the request still runs and metadata.warnings contains speech_lang was not applied: the speech model detects the language automatically. The speech analysis segments themselves don’t carry a language field — the detected language is reported for the whole file in audio insights as detected_language, a lowercase language code (or "N/A" when there is no speech). Codes are ISO 639-1 where one exists. More than 50 languages are supported.

"detected_language": "en"

Code-switching

When a single recording mixes more than one language — bilingual speakers, Korean speakers borrowing English terms, voiceovers that switch tracks — audio insights reports every language it detects, as codes joined by commas with no spaces:

"detected_language": "ko,en"

You don’t need to opt in. Split the value on , to get a list; it is a single code, a comma-separated list of codes, or "N/A".

3. Speaker profile

A Speaker profile is a voice fingerprint you create by uploading or recording audio samples of one person. Once registered, Cochl.Sense matches that profile in any new upload and exposes the registered name in speaker_name (with a similarity in speaker_score), as long as speaker recognition is enabled for your organization (details).

Use speaker profiles when you need:

  • Meeting and interview transcripts that name participants automatically.
  • Searchable archives where you can jump to “everything spoken by Anna”.
  • Per-speaker analytics—talk time, turn counts, etc.

To register a profile, see Custom sound: Speaker profile.

4. Run speech analysis

Via the Dashboard

  1. On the Dashboard, pick your Cochl.Sense Pro project at the top of the sidebar, then open Speech analysis under Project.
  2. Drop your file (or record, or pick a sample) and click Analyze. This page runs speech analysis on its own; to run it together with the other services in one request, use the API or the Python library.
  3. When the job completes, the result opens on the Speech analysis tab: the transcript with who spoke each line. You can search the transcript and filter by speaker. The run is also kept under History in the sidebar, so you can reopen it later in the same browser (Dashboard → History).

Use the IntegratedApi helper from the cochl library.

from cochl.sense import IntegratedApi, IntegratedApiOptions

api = IntegratedApi('YOUR_API_PROJECT_KEY')

job = api.analyze_file(
    'your_file.wav',
    IntegratedApiOptions(
        sound_event_detection=False,  # the service flags default to True,
        speech_analysis=True,
        audio_insights=False,         # so turn off the ones you don't want
    ),
)

result = api.get_completed_result(job['job_id'])
for seg in result['speech_analysis']['results']:
    label = seg.get('speaker_name') or seg['speaker']
    print(f"[{seg['start_time_sec']:5.2f}–{seg['end_time_sec']:5.2f}] "
          f"{label}: {seg['transcript']}")

Running this on a 30-second interview clip with two speakers prints something like:

[ 0.00– 4.32] Unknown 0: So, growing up, your father had a really strong influence on you.
[ 4.60– 8.91] Christian_Bale: Yeah, he taught me to never settle for the obvious choice.
[ 9.20–12.05] Unknown 0: And that carried into your acting?
[12.30–17.88] Christian_Bale: Absolutely. Every role becomes a question of what's underneath the surface.

And the corresponding result dict:

{
  "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
      }
    ]
  }
}

The SPEAKER_01 segment carries speaker_name: "Christian_Bale" because a profile with that name was registered ahead of time via Custom sound: Speaker profile. Unmatched turns get Unknown <n> in speaker_name, numbered to match their speaker label (SPEAKER_00 → Unknown 0).

Set sound_event_detection=True in the same IntegratedApiOptions to also detect non-speech events, or audio_insights=True to add a summary. Sound event detection is billed at $0.012 per minute; speech analysis and audio insights are free for now — see Getting Started → Valid service combinations and Usage & pricing.

cochlearai/cochl-sense-py

More runnable sample scripts.

Advanced: stream progress yourself

get_completed_result blocks until the job finishes. If you want to render a progress bar or display partial results as they arrive, subscribe to the SSE stream directly:

from urllib.request import Request, urlopen

from cochl.sense import IntegratedApi, IntegratedApiOptions

def main():
    # 1. Authenticate with the project key.
    api = IntegratedApi('YOUR_API_PROJECT_KEY')

    # 2. Speech Analysis only. The service flags default to True, so set the
    #    others to False explicitly (or True to combine).
    options = IntegratedApiOptions(
        sound_event_detection=False,
        speech_analysis=True,
        audio_insights=False,
    )

    # 3. Upload the file — the server enqueues a job and returns its id.
    job: dict = api.analyze_file('YOUR_AUDIO_FILE_PATH', options)
    if 'job_id' not in job:
        print('ERROR: analyze_file did not return a job_id')
        return
    job_id: str = job['job_id']

    # 4. Subscribe to the SSE stream. Each line is either:
    #      event: metadata | progress | partial_result | completed | error
    #      data:  <JSON payload>
    #    The first event is always `metadata` (audio info and warnings).
    request: Request = api.create_event_stream_request(job_id)
    with urlopen(request) as response:
        for line in response:
            line = line.decode('utf-8').strip()
            if line.startswith('event: ') or line.startswith('data: '):
                print(line)

if __name__ == '__main__':
    main()

Use this pattern only when you need to react to progress events as they arrive. For “upload, wait, get the dict”, get_completed_result(job_id) is shorter and handles the SSE plumbing for you.

5. Export results

In the Dashboard result view, the JSON tab shows the full payload (every service that ran, in one object). The Export menu above the result has Copy JSON, Result (JSON) to save it as a file, Sound Events (CSV) (when sound events ran) to save them as a table, and Get code for the same request in cURL or Python.

The JSON tab of an analysis result in the Dashboard

6. Best practices

  • For best transcription accuracy, use a sample rate of 16 kHz or higher and minimize background music.
  • Speaker matching works best when the profile’s recording conditions (microphone, room) are similar to those of the upload.
  • Unknown speakers get Unknown <n> in speaker_name and a diarization speaker label (SPEAKER_00, SPEAKER_01, …) that is stable within a single file. Neither persists across files — SPEAKER_00 or Unknown 0 in two different uploads is not necessarily the same person.

See also

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).

Powered by Cochl