# Custom sound: Speaker profile (https://docs.cochl.ai/docs/pro/speech-analysis/custom-speaker-profile)



**Custom sound: Speaker profile** registers a person’s voice so Cochl.Sense can identify them by name in any [speech analysis](https://docs.cochl.ai/docs/pro/speech-analysis) result. A voice that matches no profile is reported as `Unknown 0`, `Unknown 1`, …, numbered to match its diarization label (`SPEAKER_00`, `SPEAKER_01`, …).

Speaker profiles are available on **Cochl.Sense Pro projects only**.

<Callout type="info">
  Registering speaker profiles needs **speaker recognition to be enabled for your organization**. Contact [support@cochl.ai](mailto:support@cochl.ai) to have it turned on before you rely on profiles; until then every speaker comes back as `Unknown 0`, `Unknown 1`, … ([details](https://docs.cochl.ai/docs/pro/speech-analysis#when-speaker_name-is-missing)).
</Callout>

## 1. Create a Cochl.Sense Pro project [#1-create-a-cochlsense-pro-project]

If you don’t have one yet, follow [Get your project key](https://docs.cochl.ai/docs/pro/getting-started#2-get-your-project-key) and create a project (or use the **Default project** every account starts with).

## 2. Register a profile [#2-register-a-profile]

Two registration paths—via the Dashboard, or programmatically with `SpeakerProfileApi`. Pick whichever fits your flow.

### 2.1 Via the Dashboard [#21-via-the-dashboard]

On the Dashboard, open **Speaker Profiles** under **Account** in the sidebar and click **Add speaker**. The same dialog opens from the **Speech analysis** page: click **Add speaker** next to the names under **Speaker Profiles** in the run settings (**Add a voice** when there are none yet). In that one dialog you can register a voice two ways, and mix them:

* **Record** — record takes in the browser.
* **Upload** — drop audio files of the same speaker.

<img src="/images/pro/custom-speaker-profile/speaker-profiles-tab.png" alt="The Speaker Profiles page in the Dashboard, with each profile’s status and audio length" />

**Record**: enter the name shown in results, then press the red record button and speak. A take is at least 2 seconds and at most 30; press **Stop** to end it. Each take is added to the list below, where you can play it back or remove it. Record as many takes as you need (5–20 work best), then click **Save speaker**.

<img src="/images/pro/custom-speaker-profile/recording-flow.png" alt="Recording a voice sample in the Add speaker dialog" width="560" />

**Upload**: enter the name, and drag in audio files (5–20 are recommended). They should all be of the same speaker, in conditions similar to where you’ll use the profile (same microphone, room type, language). Click **Save speaker** to upload. Using a name that already exists adds the samples to that speaker.

<img src="/images/pro/custom-speaker-profile/uploading-samples.png" alt="Voice samples listed in the Add speaker dialog, ready to save" width="560" />

### 2.2 Via the Python library [#22-via-the-python-library]

If you want to register and manage profiles from code — for example, to onboard speakers as part of your own app’s signup flow — use `SpeakerProfileApi`. It runs against your organization (not a single project), so the constructor takes your **organization key**, not a project key.

```python
from cochl.sense import SpeakerProfileApi


def main():
    api = SpeakerProfileApi('YOUR_ORGANIZATION_KEY')

    # Register a new voice from an audio file (returns None on success).
    api.add_new_voice('SPEAKER_NAME', 'AUDIO_FILE_PATH')

    # List every speaker registered under this organization.
    speakers = api.list_all_speakers()
    print(speakers)

    # Find the single best-matching speaker for a whole file (no Integration job needed).
    match = api.recognize('AUDIO_FILE_PATH')
    print(match['speaker'], match['score'])

    # Remove a profile and all of its voices (returns None on success).
    # Uncomment to run — this deletes the profile registered above.
    # api.remove('SPEAKER_NAME')


if __name__ == '__main__':
    main()
```

What each method returns:

| Method                              | Returns                                                                                                                                 |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `add_new_voice(speaker, file_path)` | `None`. Call it again with the same name to add more voices to that speaker.                                                            |
| `list_all_speakers()`               | A list with one entry per registered speaker in the organization.                                                                       |
| `recognize(file_path)`              | One best match for the whole file: `{"speaker": ..., "score": ..., "org_pub_id": ...}`. `speaker` is `Unknown` when no profile matches. |
| `remove(speaker)`                   | `None`. Deletes the speaker and all of their registered voices.                                                                         |

Each method raises `CochlSenseException` when the request fails ([Error codes → §6.2](https://docs.cochl.ai/docs/pro/error-codes#62-speakerprofileapi-speaker-registration--recognition--organization-key)).

Speaker names may only contain letters, digits, and underscores (`_`), up to 50 characters — see [§6 Limitations](#6-best-practices--limitations) for the full naming rule and other constraints.

You can find your organization key (shown as **Account key**) at the bottom of the **Speaker Profiles** page on the Dashboard (under **Account** in the sidebar).

<Card title="&#x22;cochlearai/cochl-sense-py&#x22;" description="&#x22;More runnable sample scripts.&#x22;" href="https://github.com/cochlearai/cochl-sense-py" />

## 3. Verify the profile [#3-verify-the-profile]

Profiles appear on the **Speaker Profiles** page with their creation date and total registered audio length; open one to see and play its voice samples. The page also surfaces `is_compatible` — `false` (shown as **Needs re-upload**) means a model upgrade has invalidated the profile and you should re-register.

## 4. Run speech analysis with profiles [#4-run-speech-analysis-with-profiles]

Profiles take effect automatically. Upload any file with [speech analysis](https://docs.cochl.ai/docs/pro/speech-analysis) enabled — registered speakers will be matched and named in the transcript. Voices that match no profile come back as `Unknown 0`, `Unknown 1`, … ([details](https://docs.cochl.ai/docs/pro/speech-analysis#when-speaker_name-is-missing)).

```json
{
  "speaker": "SPEAKER_02",
  "speaker_name": "Anna_Kim",
  "speaker_score": 0.42,
  "transcript": "Let's review the agenda.",
  "start_time": "00:12.40",
  "end_time": "00:14.90",
  "start_time_sec": 12.4,
  "end_time_sec": 14.9
}
```

When a voice doesn’t match any registered profile, `speaker_name` is `Unknown <n>`, numbered to match the diarization label in `speaker` (`SPEAKER_00` → `Unknown 0`) — stable within a single file but not across files. `speaker_score` is still a number: the similarity to the closest profile, or `-1.0` if the organization has no profiles yet. See [speech analysis → Transcription output](https://docs.cochl.ai/docs/pro/speech-analysis#1-transcription-output) for the full field list.

## 5. Check the result on the Dashboard [#5-check-the-result-on-the-dashboard]

Once a profile is registered, open **Speech analysis** under **Project** and run an audio file. The result has two tabs:

* **Speech analysis**—per-utterance transcript with speaker labels. Registered speakers appear under their profile name; unmatched voices appear as `Unknown 0`, `Unknown 1`, …
* **JSON**—the raw result

<img src="/images/pro/custom-speaker-profile/dashboard-speaker-result.png" alt="Speech analysis result panel showing a registered speaker matched in the Dashboard" />

The **JSON** tab holds the raw payload of every analysis that ran; **Copy JSON** and &#x2A;*Result (JSON)** in the **Export** menu export it.

<img src="/images/pro/custom-speaker-profile/view-json-modal.png" alt="The JSON tab of an analysis result in the Dashboard" />

## 6. Best practices & limitations [#6-best-practices--limitations]

**Best practices**

* **5–20 samples is the sweet spot.** Fewer hurts accuracy; more doesn’t help proportionally.
* **Match conditions.** Use the same kind of microphone and acoustic environment as your target uploads.
* **Single speaker per profile.** Don’t mix voices into one profile.
* **Re-register after model upgrades.** When `is_compatible` flips to `false`, the underlying voice model has changed and the profile needs to be re-registered before recognition will use it again.

**Limitations**

* **Speaker names:** letters, digits, and underscores (`_`) only — no spaces, hyphens, periods, or other punctuation. Letters and digits from any script are accepted (`김민지` and `Anna_Kim` are valid; `Anna Kim` and `Anna-Kim` are not). Keep names to **50 characters** or fewer — that is the stored length.
* **Voice files:** up to **10 MB** each with the Python library (checked by the library; the server doesn’t check file size or duration). A take recorded in the Dashboard is at most 30 seconds.
* **Samples per speaker:** up to **20** (5–20 recommended — see Best practices above). The 21st is rejected with `max voices (20) exceeded for speaker '<name>'`.
* **Speakers per organization:** up to **50** total. Registering a 51st is rejected with `max speakers (50) exceeded for organization`.
* **Supported audio formats:** same as the rest of Cochl.Sense Pro — see [Getting Started → Additional notes](https://docs.cochl.ai/docs/pro/getting-started#6-additional-notes).

See [Error codes → §5 speaker recognition errors](https://docs.cochl.ai/docs/pro/error-codes#5-speaker-recognition-errors-organization-key--apiv2) for every error message and how it’s returned.

## See also [#see-also]

* [Speech analysis](https://docs.cochl.ai/docs/pro/speech-analysis)—feature overview, output schema, and best practices
* [Custom sound: Sound events](https://docs.cochl.ai/docs/core/sound-event-detection/custom-sound)—the other custom sound type. Available on Cochl.Sense Core only, for training new sound tags.
