voice_clones and the scope voices:write. Uploading a sample also needs
media:write, and using the clone needs projects:write to create a project or dubbing:write to dub one, each with credits:spend.
The program at the end also reads the project, which needs projects:read.
1. Check the quota
used counts the workspace’s clones that are processing or ready, and remaining is how many are left. A failed or deleted clone
frees its place. With none left, createVoiceClone answers 403
voice_clone_limit_reached. Beside this quota, the payer has a daily cap on clone creations, which
also counts deleted and instant clones (429 rate_limited, policy clone-create-day).
2. Upload a sample
Sendpurpose: voice_sample. A sample can be audio up to 11 MB, kept as uploaded, or video up to 500 MB, whose audio is extracted to MP3
on import. As stored, each sample must be 11 MB or less: an import whose extracted audio is larger fails with media_too_large.
result.media_id of the media_import job.
3. Create the clone
Give 1 to 10 samples, and set the two settings if you want other than the defaults. Both run from 0 to 1.rights_confirmed must be
true: it attests that you are the speaker or have their permission, and it is recorded.
{"type": "project_speaker", "project_id": "PROJECT_ID", "speaker_id": "SPEAKER_01"} as the
source.
The answer is a voice_clone job. The clone exists at once with status: processing, and the job’s params.voice_clone_id names it.
When the job succeeds, the clone is ready and result.voice_clone_id names it too. When the job fails, the clone is failed, with its
failure, and no longer counts against the quota.
4. Read its voice ids
A clone has one voice per language. getVoiceClone lists them inlanguages, each with its voice_id and a
sample. That voice_id is what you assign to a speaker.
5. Change its settings
- Settings apply to the next segment generation or dub at once.
- Segments whose speaker uses the clone get
dub_state: outdated, so the next dub voices them again. - Each language’s sample is regenerated when the clone is next used in that language. Until then
samples_statusisregeneratingand that language’ssampleis null. If a regeneration fails,samples_statusisstaleand the next use in that language tries again; the settings still apply. - A clone still
processingcannot be changed: 409voice_clone_not_ready. - By default a clone takes 10 settings changes per hour (429
rate_limited, policyvoice-settings-hour). A request that only renames the clone, or sends the settings it already has, does not count. - The source files cannot be replaced: create a new clone.
6. Use it on a project
On a new project, name the voice inspeaker_voices, so the first dub already uses it. Speaker 1 is the first speaker that detection
numbers. A label that never occurs is ignored with the notice speaker_voice_unused. If a voice cannot be applied once speakers are
known, the speaker keeps the suggested voice, with the notice speaker_voice_not_applied.
outdated.
effects.next_dub_mode says which mode the next dub applies. Then estimateDub and
createDub with mode: changed_segments voice the change. On a project that has never been dubbed, that mode
is refused with no_previous_dub (409 from createDub, a reason in the estimate): use mode: auto for its first
dub.
Instant clones
A speaker can also use their own voice, an instant clone, without a library clone. Assign theinstant_clone voice from
listProjectVoices, with instant_clone_settings. It needs the plan feature instant_voice_clone, and a
speaker it can work for: instant_clone.eligible and instant_clone.reason on the speaker say whether it can (enough speech, a supported
language and voice provider). Otherwise the assignment answers 422
instant_clone_not_available. The first instant_clone_settings for a speaker create its instant
clone, which counts against the daily cap; changing them later counts against voice-settings-hour.
The whole program
clone_voice.py