# Voice Match — speaker similarity & TTS consistency (`synthetic.ia/voice-match`) Actor

Compare a reference voice against one or more audios and get a similarity score + same/different-voice decision. Built for TTS consistency QC: generate several takes, keep the ones that match. ECAPA-TDNN, CPU, no GPU, no key.

- **URL**: https://apify.com/synthetic.ia/voice-match.md
- **Developed by:** [Synthetic](https://apify.com/synthetic.ia) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 voice comparisons

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Voice Match — same-voice check & TTS consistency (speaker similarity)

Ask a simple question over an API: **"is this the same voice as my reference?"** Give a **reference** audio and one or more **candidate** audios, and get back a **similarity score (0–1)** plus a **same / different-voice decision** for each — ranked, with the best match flagged. Built especially for **TTS consistency QC**: when you generate a voice several times and it drifts, run your takes through this and **keep the ones that match** (or regenerate until one passes). Runs on CPU, no GPU, no API key.

- 🎯 **Same voice?** — reference vs candidate → cosine similarity + pass/fail
- 🔁 **Batch / ranking** — one reference vs many candidates → sorted by similarity, best match flagged (perfect for "generate N takes, pick the matching one")
- 🎚️ **Selectable strictness** — `tts` (same synthetic voice, strict), `strict`, `balanced`, `tolerant` (noisy/phone), or a custom threshold
- 🧠 **ECAPA-TDNN** speaker embeddings (near state-of-the-art), with ffmpeg preprocessing (16 kHz mono, silence-trim, loudness-normalize) for accuracy
- 🛡️ **AI-voice flag (advisory)** — every audio also gets an `aiGenerated` signal (is it a deepfake/synthetic voice?). Keep it on for QC, or run **`operation: "detect"`** to only screen audios for AI generation, no reference needed.
- 💵 Pay per comparison · no key · no GPU

### The use case it was built for

You generate TTS (Google, ElevenLabs, our own [AI Voice Generator](https://apify.com/synthetic.ia/ai-voice-generator)…) and across takes the voice **varies** — you end up regenerating until it "sounds right". Instead: pick one good take as the **reference**, generate a batch, send them here, and the Actor tells you **which takes match the reference** and by how much. Automate the loop: accept the first candidate that passes, or regenerate if none do.

### Sample output (batch)

```json
{
  "ok": true, "level": "tts", "threshold": 0.72,
  "reference": { "durationSec": 6.4 },
  "count": 3, "matched": 2,
  "best": { "index": 1, "score": 0.94, "sameVoice": true },
  "ranked": [
    { "index": 1, "score": 0.94, "sameVoice": true,  "durationSec": 5.9 },
    { "index": 0, "score": 0.78, "sameVoice": true,  "durationSec": 6.1 },
    { "index": 2, "score": 0.55, "sameVoice": false, "durationSec": 6.0 }
  ]
}
```

### Input

- **referenceAudio** — the voice to match against (http(s) URL or base64). ~5–10 s of clean speech works best.
- **candidateAudios** — one or more audios to compare (your several takes).
- **level** — `tts` (default, strict; same synthetic voice), `strict`, `balanced`, `tolerant` (noisy). Or set **threshold** (0–100, e.g. `70` = cosine 0.70) to override.

### AI-voice detection (advisory)

Alongside the similarity check, each audio is scored by a deepfake-audio classifier (wav2vec2) and gets:

```json
"aiGenerated": { "likelyAiGenerated": false, "aiConfidence": 0.03 }
```

Leave `detectAi` on to flag synthetic/cloned audio during QC, or set **`operation: "detect"`** and pass **`audios`** to screen a batch with no reference. This is an **advisory signal, not a verdict** — modern TTS can be very clean and detection is probabilistic; treat it as a heads-up, not proof.

### How similarity maps to a decision

The score is the **cosine similarity** of the two voices' ECAPA-TDNN embeddings. Same-voice pairs score high (typically 0.7–0.95, and near-identical TTS takes even higher); different voices score lower. The chosen **level** sets the cutoff for `sameVoice`. You always get the raw score too, so you can tune the cutoff to your data.

### Pricing

**Per comparison** from **$0.02** (drops to $0.008 on higher tiers). A batch of 5 candidates = 5 comparisons. Platform usage included. No GPU cost — this runs on CPU.

### Related Actors

- **[AI Voice Generator & Cloner](https://apify.com/synthetic.ia/ai-voice-generator)** — generate/clone the voices, then verify consistency here.
- **[ffmpeg API](https://apify.com/synthetic.ia/ffmpeg-api)** — convert/trim audio before comparing.

### Accuracy & honest limits

This is **voice biometrics**, which is **probabilistic, not a guarantee** — the score is a confidence, not proof of identity. Accuracy is high with **clean, ≥5 s** clips and drops with noise, very short audio, heavy compression, or cross-condition recordings (studio vs phone). For your TTS-consistency use case (same generator, clean output) separation is large and results are very reliable. The `aiGenerated` flag is an **advisory** deepfake signal, not a guarantee — a good AI clone can still score high against the original by design, so this is **not** a standalone security/anti-fraud authenticator (that needs liveness + full anti-spoofing).

### Privacy

Voice is sensitive personal data. Only compare audio you have the right to use, and don't use this to identify or track people without their consent.

# Changelog

This Actor's version history is a separate document: https://apify.com/synthetic.ia/voice-match/changelog.md

# Actor input Schema

## `referenceAudio` (type: `string`):

The known voice that everything is compared against. An http(s) URL or base64. About 5–10 seconds of clean speech works best.

## `candidateAudios` (type: `array`):

One or more audios to check against the reference (e.g. your other TTS takes). URLs or base64. The example compares one clip of the same speaker (match) and one of a different speaker (no match).

## `level` (type: `string`):

How close the voices must be to count as the same. 'TTS' = same synthetic voice across takes (strict). 'Tolerant' = noisy/phone audio. You always get the raw score too.

## `detectAi` (type: `boolean`):

Adds an 'aiGenerated' confidence to every audio. Turn off if you only care about the voice match (a little faster).

## `threshold` (type: `integer`):

Use your own cut-off instead of the Strictness preset: cosine similarity × 100 (e.g. 70 = 0.70). Leave empty to use the preset.

## Actor input object example

```json
{
  "referenceAudio": "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk1_snt1.wav",
  "candidateAudios": [
    "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk1_snt2.wav",
    "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk2_snt1.wav"
  ],
  "level": "tts",
  "detectAi": true
}
```

# Actor output Schema

## `result` (type: `string`):

The comparison result JSON.

## `runs` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "referenceAudio": "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk1_snt1.wav",
    "candidateAudios": [
        "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk1_snt2.wav",
        "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk2_snt1.wav"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("synthetic.ia/voice-match").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "referenceAudio": "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk1_snt1.wav",
    "candidateAudios": [
        "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk1_snt2.wav",
        "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk2_snt1.wav",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("synthetic.ia/voice-match").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "referenceAudio": "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk1_snt1.wav",
  "candidateAudios": [
    "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk1_snt2.wav",
    "https://raw.githubusercontent.com/speechbrain/speechbrain/develop/tests/samples/ASR/spk2_snt1.wav"
  ]
}' |
apify call synthetic.ia/voice-match --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,synthetic.ia/voice-match"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/9QWBVTJ11knYI52G5/builds/yv30kqur9ItZmBJUr/openapi.json
