SAGEA LogoDocs & API
CookbooksVoice Cookbooks

Clone a Custom Voice with Sonus

Create a reusable custom voice from 1 to 3 audio samples with POST https://api.sagea.space/v1/audio/clone.

  • Upload two 10s+ samples and create a voice_id
  • Synthesize a test line with the cloned voice
  • A/B compare cloned output against stock voice nova

Time to complete: ~15 minutes

Prerequisites

  • Python 3.9+ with pip install requests.
  • Two clean samples (sample1.wav, sample2.wav), each 10s or longer, single speaker, low noise.
  • A SAGEA API key exported as SAGEA_API_KEY.
  • Read Synthesize speech with Sonus for synthesis basics.
  • Skim the Sonus TTS model card for cloning limits and pricing.

Step 1: Prepare two voice samples

Use 16kHz or higher WAV files, one speaker, no music. Cloned voices cost $30 per 1M chars.

ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1 sample1.wav
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1 sample2.wav
ls -lh sample1.wav sample2.wav

Each file must be at least 10 seconds. Record in a quiet room for best similarity.

Step 2: Create the cloned voice

Call POST https://api.sagea.space/v1/audio/clone with multipart name, audio_samples, and language. It returns a voice_id starting with vox_.

curl -X POST https://api.sagea.space/v1/audio/clone \
  -H "Authorization: Bearer $SAGEA_API_KEY" \
  -F name="brand_voice" \
  -F audio_samples=@"sample1.wav" \
  -F audio_samples=@"sample2.wav" \
  -F language="en-US"

Example response is {"voice_id": "vox_a1b2c3d4"}. Save that ID for synthesis.

Step 3: Synthesize a test line and A/B compare

Use the voice_id as voice in POST https://api.sagea.space/v1/audio/speech, then render the same line with nova.

VOICE_ID="vox_a1b2c3d4"
curl -X POST https://api.sagea.space/v1/audio/speech \
  -H "Authorization: Bearer $SAGEA_API_KEY" -H "Content-Type: application/json" \
  -d "{\"model\": \"sonus-tts\", \"input\": \"Hello, this is our brand voice speaking.\", \"voice\": \"$VOICE_ID\", \"response_format\": \"mp3\", \"emotion\": \"neutral\", \"speed\": 1.0}" \
  --output cloned.mp3
curl -X POST https://api.sagea.space/v1/audio/speech \
  -H "Authorization: Bearer $SAGEA_API_KEY" -H "Content-Type: application/json" \
  -d '{"model": "sonus-tts", "input": "Hello, this is our brand voice speaking.", "voice": "nova", "response_format": "mp3", "emotion": "neutral", "speed": 1.0}' \
  --output stock.mp3

Compare with ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1 cloned.mp3 and pick by clarity and similarity.

Verify

A successful clone returns HTTP 200 with a voice_id. If it fails, check the error table below.

ErrorCauseFix
401 UnauthorizedAPI key missing or invalidRe-export SAGEA_API_KEY with a valid key
400 text_too_longTest line exceeds 4096 charsShorten the synthesis input to under 4096 chars
422 voice_not_foundBad voice_id in synthesis stepCopy voice_id exactly, it starts with vox_
429 rate_limit_exceededOver 50 req per min on Starter, 500 on ProWait 60 seconds and retry with backoff

What's next

On this page