Skip to main content

Internal Project Voice Sample Preview

This is an internal authenticated backend route used by the VoiceCheap app. It is not part of the public API key surface.

Route

  • Method: POST
  • Path: /speech/project-voice-sample-preview
  • Auth: Bearer access token required

Request body

{
  "projectId": "project_123",
  "speakerNumber": 0,
  "voiceCloningSettings": {
    "stability": 0.6,
    "similarity": 0.8,
    "speakerBoost": 0.6
  }
}

Response

{
  "speakerNumber": 0,
  "audioBase64": "<base64-mp3>",
  "mimeType": "audio/mpeg"
}

Behavior

  • Resolves the project and checks the requester has access.
  • Downloads the stored original audio.
  • Cuts and concatenates the selected speaker audio from the project transcription.
  • Caps source speech at 5 minutes per speaker.
  • Creates a temporary cloned voice, generates one preview sentence in the first target language, then deletes the temporary voice.
  • Returns the preview as base64 MP3 data for immediate playback in the app.

Rate limiting

  • This route is intentionally low-rate-limit.
  • 429 response:
{
  "code": "PROJECT_VOICE_SAMPLE_RATE_LIMIT_REACHED",
  "message": "Voice previews are limited right now. Please wait a few minutes before generating another sample."
}

Project data changes

Project creation now stores persisted examples on the dubbing project under voicePreviewSamples[]:
[
  {
    "speakerNumber": 0,
    "audioUrl": "https://...",
    "targetLanguage": "french",
    "createdAt": 1741950000000
  }
]
Stored voicePreviewSamples[].audioUrl files are deleted when the project is deleted.