All Products
Search
Document Center

Alibaba Cloud Model Studio:Voice cloning

Last Updated:Oct 15, 2026

Create a custom voice from an audio sample for speech synthesis or real-time voice conversations.

Feature overview

Voice cloning supports personalized voice assistants, brand-specific announcements, and customized audio content without model training.

NoteTo create a voice from a natural language description without an audio sample, use Voice design.

Prerequisites

Get started

NoteCloned voices for Qwen-Audio-TTS / Qwen-Audio-Realtime / CosyVoice are bound to their target_model at creation and cannot be used with another model. To use the same reference voice with multiple models, create a separate voice for each model.

Qwen-Audio-TTS / CosyVoice

Qwen-Audio-TTS and CosyVoice use the same voice creation and basic synthesis workflow. The following example uses qwen-audio-3.1-tts-flash.

  1. Create a voice: Set url to the reference audio URL, target_model to the target model, and prefix to the voice name prefix.
  2. Synthesize speech: Pass the returned voice ID as voice, use the same target model, and save the synthesized audio.
import os

import dashscope
from dashscope.audio.tts_v2 import AudioFormat, SpeechSynthesizer, VoiceEnrollmentService

dashscope.api_key = os.environ["DASHSCOPE_API_KEY"]
workspace_id = "YOUR_WORKSPACE_ID"
target_model = "qwen-audio-3.1-tts-flash"
dashscope.base_http_api_url = (
    f"https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1"
)
dashscope.base_websocket_api_url = (
    f"wss://{workspace_id}.cn-beijing.maas.aliyuncs.com/api-ws/v1/inference"
)

# Create a voice.
service = VoiceEnrollmentService()
voice_id = service.create_voice(
    target_model=target_model,
    prefix="myvoice",
    url="https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/cosyvoice/cosyvoice-zeroshot-sample.wav",
)
print(f"voice_id: {voice_id}")

# Synthesize speech with the bound model and the returned voice ID.
synthesizer = SpeechSynthesizer(
    model=target_model,
    voice=voice_id,
    format=AudioFormat.WAV_24000HZ_MONO_16BIT,
)
audio = synthesizer.call("The weather is pleasant today. Enjoy a walk outside and have a wonderful day.")
with open("output.wav", "wb") as f:
    f.write(audio)

The example saves the synthesized audio to output.wav. Save the printed voice ID for later use.

Qwen-Audio-Realtime

Cloned voices for Qwen-Audio-Realtime customize the response voice in real-time voice conversations. The following example creates a voice for qwen-audio-3.1-realtime-plus.

import os

import dashscope
from dashscope.audio.tts_v2 import VoiceEnrollmentService

dashscope.api_key = os.environ["DASHSCOPE_API_KEY"]
workspace_id = "YOUR_WORKSPACE_ID"
target_model = "qwen-audio-3.1-realtime-plus"
dashscope.base_http_api_url = (
    f"https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1"
)

# Create a voice.
service = VoiceEnrollmentService()
voice_id = service.create_voice(
    target_model=target_model,
    prefix="myvoice",
    url="https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/cosyvoice/cosyvoice-zeroshot-sample.wav",
)
print(f"voice_id: {voice_id}")

After connecting to the real-time voice conversation service, set session.voice to the returned voice ID in the first session.update event. Replace VOICE_ID below with that ID. The session model must match the target_model used to create the voice.

{
    "type": "session.update",
    "session": {
        "voice": "VOICE_ID"
    }
}

For more voice cloning parameters and examples, see the HTTP API, Python SDK, and Java SDK.

To use a cloned voice for speech synthesis or real-time voice conversations, see:

Audio requirements

Input audio quality affects voice similarity and naturalness. Follow the target model’s specifications and the recording tips below to reduce noise, reverberation, and other speakers’ voices.

ItemRequirement

Formats

WAV (16-bit), MP3, M4A

Duration

10–20 seconds recommended; no more than 60 seconds.

File size

≤ 10 MB

Sample rate

≥ 16 kHz

Channels

Mono or stereo. Only the first channel of stereo audio is processed, and it must contain valid speech.

Content

At least 5 seconds of continuous, clear reading, with only short pauses (≤ 2 seconds) elsewhere. Avoid background music, environmental noise, and other speakers. Use speech at a normal pace, rather than songs or singing recordings.

Supported languages

  • Qwen-Audio-TTS / Qwen-Audio-Realtime: Chinese (Mandarin, Cantonese, Chongqing, Northeastern, Gansu, Guizhou, Zhejiang, Hebei, Henan, Hubei, Hunan, Jiangxi, Ningbo, Ningxia, Qingdao, Shaanxi, Shanxi, Shandong, Shanghai, Sichuan, and Yunnan dialects), English, Japanese, Korean, Russian, French, German, Portuguese, Thai, Indonesian, Vietnamese, Spanish, Italian, Malaysian, Filipino, and Arabic
  • CosyVoice: Supported reference audio languages vary by the target model that uses the voice.

Click to view supported languages by CosyVoice model

  • cosyvoice-v3.5-plus, cosyvoice-v3.5-flash, cosyvoice-v3-flash: Chinese (Mandarin, Cantonese, Northeastern, Gansu, Guizhou, Henan, Hubei, Jiangxi, Southern Min, Ningxia, Shanxi, Shaanxi, Shandong, Shanghai, Sichuan, Tianjin, and Yunnan dialects), English, French, German, Japanese, Korean, Russian, Portuguese, Thai, Indonesian, and Vietnamese
  • cosyvoice-v3-plus: Chinese (Mandarin, Cantonese, Northeastern, Gansu, Guizhou, Henan, Hubei, Jiangxi, Southern Min, Ningxia, Shanxi, Shaanxi, Shandong, Shanghai, Sichuan, Tianjin, and Yunnan dialects), English, French, German, Japanese, Korean, and Russian
  • cosyvoice-v2: Chinese (Mandarin) and English

Clear, natural recordings help produce high-quality reference audio and preserve voice characteristics. Before recording, review the recording and operation tips below.

Click to view recording and operation tips

Recording equipment

You can use a smartphone, digital voice recorder, or professional recording device. We recommend a device that supports high sample rate recording (≥ 24 kHz) to meet the audio requirements.

Recording environment

Location

  • Record in a small, enclosed space of 10 square meters or less.
  • Prioritize rooms with sound-absorbing materials such as acoustic foam, carpets, or curtains.
  • Avoid open halls, conference rooms, classrooms, and other high-reverberation spaces.

Noise control

  • External noise: Close doors and windows to avoid traffic, construction, and other disturbances.
  • Internal noise: Turn off air conditioners, fans, fluorescent lamp ballasts, and other equipment. You can record the ambient sound on your phone and play it back at high volume to identify potential noise sources.

Reverberation control

  • Reverberation causes sound to become blurry and reduces clarity.
  • Reduce reflections from smooth surfaces: close curtains, open wardrobe doors, and drape clothing or blankets over tables and cabinets.
  • Use irregular objects (such as bookshelves and upholstered furniture) to create diffuse reflections.

Recording script

  • There are no specific content restrictions. We recommend matching the content to your target use case.
  • Avoid short phrases (such as "hello" or "yes"). Use complete sentences.
  • Maintain semantic coherence and avoid frequent pauses while reading (at least 3 continuous seconds without interruption is recommended).
  • Maintain a consistent speaking speed throughout. Avoid speaking too fast at the beginning or end, which can cause stuttering during synthesis.
  • Include appropriate emotional expression (such as warmth, friendliness, or seriousness). Avoid mechanical reading.
  • Do not include sensitive content (such as political, pornographic, or violent material). This will cause cloning to fail.

Best practices

Using a typical bedroom as an example, after completing noise and reverberation control:

  1. Familiarize yourself with the script beforehand, set a character tone, and deliver naturally.
  2. Maintain approximately 10 cm distance from the recording device to avoid plosive distortion or weak signal.

Voice management

Qwen-Audio-TTS, Qwen-Audio-Realtime, and CosyVoice share the same voice query, update, and deletion APIs. For interfaces and parameters, see the Voice cloning HTTP API reference.

  • List voices: View existing custom voices under your account.
  • Query voice details: View information such as creation time and the bound model.
  • Update a voice: Replace the reference audio while retaining the existing voice ID.
  • Delete a voice: Delete unused voices to free up quota.

Created voices remain valid by default. Save the voice ID and query the voice when needed to check its availability.

Supported models

China (Beijing)

Use an API key for this region to call the following models:

  • Qwen-Audio-TTS: qwen-audio-3.1-tts-flash, qwen-audio-3.0-tts-plus, qwen-audio-3.0-tts-flash

  • Qwen-Audio-Realtime: qwen-audio-3.1-realtime-plus, qwen-audio-3.0-realtime-plus, qwen-audio-3.0-realtime-flash

  • CosyVoice: cosyvoice-v3.5-plus, cosyvoice-v3.5-flash, cosyvoice-v3-plus, cosyvoice-v3-flash, cosyvoice-v2

Singapore

Use an API key for this region to call the following models:

  • Qwen-Audio-TTS: qwen-audio-3.0-tts-plus, qwen-audio-3.0-tts-flash

  • CosyVoice: cosyvoice-v3-plus, cosyvoice-v3-flash

Quotas and limits

  • Voice count: Each Alibaba Cloud Model Studio account can have up to 1,000 custom voices in total. Voice cloning and voice design share this account quota across models.

    Note

    • New voice cloning or voice design creation requests fail when the quota is reached. Delete unused voices to free up quota before creating another voice.

Billing

  • Qwen-Audio-TTS / Qwen-Audio-Realtime / CosyVoice: Voice creation is free. Speech synthesis and real-time conversations using cloned voices are billed according to the target model. See Model pricing.