import type * as core from "../../../../../core/index.js"; import type * as SarvamAI from "../../../../index.js"; /** * @example * { * voice_id: "svc-123e4567-e89b-12d3-a456-426614174000", * text: "\u0928\u092E\u0938\u094D\u0924\u0947, \u092E\u0948\u0902 \u0906\u092A\u0915\u0940 \u0915\u0948\u0938\u0947 \u092E\u0926\u0926 \u0915\u0930 \u0938\u0915\u0924\u093E \u0939\u0942\u0901?" * } */ export interface VoiceCloningRequest { /** Saved cloned voice ID (`svc-{uuid}`) from `POST /voices/create` or Content Studio. Exactly one of `ref_audio` or `voice_id` must be provided — sending both returns `400`. Prefer `voice_id` when you already saved the voice so you do not re-upload the clip. */ voice_id?: string; /** * Reference audio clip used to clone the voice for this request. Supported formats: WAV, MP3, FLAC, OPUS, AAC, MULAW, ALAW, LINEAR16. WAV is recommended. * * Limits: max file size 10 MB; max duration 15 seconds; single speaker. Exactly one of `ref_audio` or `voice_id` must be provided — sending both returns `400`. */ ref_audio?: core.file.Uploadable | undefined; /** Optional transcript of `ref_audio` (max 500 characters). Improves fidelity when provided. Omit or leave empty to let the API transcribe the clip. Ignored when `voice_id` is used. */ ref_text?: string; /** Text to synthesize in the cloned voice. Native scripts and code-mixed text are supported. Maximum 1000 characters; longer text is rejected with a 400. Split longer input client-side and synthesize it in parts. */ text: string; /** * BCP-47 language code for the synthesized output. The cloned voice can speak any supported language, regardless of the reference clip's language (cross-lingual cloning). Omit it to detect the language from `text`. Detection can be wrong on short or code-mixed text — pass this when pronunciation has to be exact. Romanized Indic and Urdu return 400; short Assamese without ৰ or ৱ is often detected as Bengali, so pass `as-IN`. * * **Available Options:** * - `as-IN`: Assamese * - `bn-IN`: Bengali * - `en-IN`: English (Indian) * - `gu-IN`: Gujarati * - `hi-IN`: Hindi * - `kn-IN`: Kannada * - `ml-IN`: Malayalam * - `mr-IN`: Marathi * - `od-IN`: Odia * - `pa-IN`: Punjabi * - `ta-IN`: Tamil * - `te-IN`: Telugu */ language_code?: SarvamAI.VoiceCloningLanguage; /** Speech speed multiplier. `1.0` is natural speed; `0.5` to `2.0` is accepted. Speed is adjusted without changing pitch. Mutually exclusive with `max_audio_duration` - sending both returns a 400 error. */ pace?: number; /** * Audio codec for the output audio. Default is `wav`. * * - `wav`: Uncompressed. Best quality for downstream processing. * - `mp3`: Smaller file size; suitable for web playback. * - `flac`: Lossless compression. * - `opus`: Low-bitrate codec ideal for streaming. When `speech_sample_rate` is explicitly set with `opus`, it must be one of 8000, 16000, 24000 or 48000 Hz; when omitted, opus output is returned at the native 24000 Hz. * - `aac`: Common in mobile and broadcast. * - `linear16`: Raw 16-bit PCM. * - `mulaw` / `alaw`: 8-bit telephony codecs for IVR pipelines. */ output_audio_codec?: SarvamAI.VoiceCloningOutputAudioCodec; /** Output sample rate in Hz. Supported values are 8000, 16000, 22050, 24000, 32000, 44100, 48000. If omitted, the API returns 24000 Hz. This is a service-side default: the output is resampled to it, so it does not change with the generating model. Set it to match your downstream pipeline: 8000 for telephony/IVR, 16000 for voice agents, 24000 for web playback, 44100/48000 for broadcast. */ speech_sample_rate?: SarvamAI.SpeechSampleRate; /** Run the quality-control pipeline. Off by default. When enabled, the generated audio is transcribed and verified before the response is returned, which adds latency -- roughly half a second for single-script text, and several seconds for code-mixed text. */ enable_qc?: boolean; /** Enable response caching. Coming soon - accepted for forward compatibility, currently ignored. */ enable_cached_responses?: boolean; /** Enable VAD-based silence trimming of the generated audio. Default is `true`. Applies to single-chunk (short) generations; long text that is split into sentence chunks is returned untrimmed. */ enable_vad?: boolean; /** Remove background noise from the reference audio before synthesis. Uses ML-powered vocal extraction to isolate the speaker's voice. Only applies when `ref_audio` is provided; ignored when using `voice_id` (a saved voice keeps whatever processing it received when it was created). Adds processing latency -- roughly 1 second for a typical reference clip. */ remove_background_noise?: boolean; /** Enable pre-TTS text normalization: numbers, currencies and dates are converted to their spoken form before synthesis (e.g. `9840950950` becomes the spoken digit sequence). Defaults to the server-side setting. Supported for all 12 languages accepted by `language_code`; any other code passes through unchanged. */ enable_text_normalization?: boolean; /** Minimum output audio duration in seconds. If the generated audio is shorter, it is padded with silence. */ min_audio_duration?: number; /** Maximum output audio duration in seconds. If the generated audio is longer, it is time-stretched to fit. Must be >= `min_audio_duration`. Silently floored to the reference clip's duration when the clip is longer. Mutually exclusive with `pace` - sending both returns a 400 error. */ max_audio_duration?: number; /** Override for the reference audio duration in seconds. Useful for dubbing/sync scenarios where the model should treat the reference as a specific length. */ ref_audio_duration?: number; }