API reference

Updated at:

The long-text speech synthesis feature lets you synthesize long-form text, such as text containing thousands of characters, into binary voice data. This feature also supports Speech Synthesis Markup Language (SSML) to add background music, pauses, and ensure correct pronunciation.

Billing and concurrency limits

Features

  • Supports PCM, WAV, and MP3 audio encoding formats.

  • Supports sending text up to 10,000 characters once per session.

  • Supports text input in UTF-8 encoding.

  • Supports setting the speech rate, pitch, and volume.

  • Supports setting different voices.

  • Supports SSML tags.

  • Supports the timestamp feature.

  • Does not support sending text in streams.

Voice list

Note

To sample more synthesis effects, visit the Speech Synthesis product page. The product page provides samples for most voices. If the voice you want is not available on the page, you can call the API to listen to a sample.

CosyVoice-V2 voices

Name

Voice name

(voice parameter value)

Type

Scenario

Supported languages

Supported sample rates

Timestamp support

SSML support

Longcheng

longcheng_v2

Sunny male voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longhua

longhua_v2

Lively girl

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longshu

longshu_v2

Male news anchor voice

News broadcasting, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Bella2.0

loongbella_v2

Female news anchor voice

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longwan

longwan_v2

Mandarin female voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longxiaochun

longxiaochun_v2

Gentle Sister

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longxiaoxia

longxiaoxia_v2

Gentle female voice

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longhuhu

longhuhu

An innocent and carefree girl

Child's voice

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longanpei

longanpei

Young female teacher

Consumer electronics - Education and training

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longdaiyu

longdaiyu

Delicate and talented female voice

Short video dubbing

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longgaoseng

longgaoseng

Enlightened monk voice

Short video dubbing

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingmu

longyingmu

An elegant and sophisticated woman

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingxun

longyingxun

A young, inexperienced man

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingcui

longyingcui

Stern male collection agent voice

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingda

longyingda

Cheerful high-pitched female voice

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingjing

longyingjing

An unassuming and composed woman

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingyan

longyingyan

A stern and righteous woman

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingtian

longyingtian

Gentle and sweet female voice

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingbing

longyingbing

A sharp and commanding woman

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingtao

longyingtao

A woman with a gentle and calm demeanor

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyingling

longyingling

Mild and empathetic female voice

Customer service

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

YUMI

longyumi_v2

Proper young woman

Voice assistant

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longanran

longanran

Lively and textured female voice

Livestreaming e-commerce

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longanxuan

longanxuan

Female-Hosted Live Stream

Livestreaming e-commerce

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longanchong

longanchong

Enthusiastic Salesperson

Livestreaming e-commerce

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longanping

longanping

High-pitched female livestreamer voice

Livestreaming e-commerce

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longbaizhi

longbaizhi

Wise female narrator voice

Audiobook

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longsanshu

longsanshu

Steady and textured male voice

Audiobook

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longxiu

longxiu_v2

Erudite male storyteller voice

Audiobook

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longmiao

longmiao_v2

Cadenced female voice

Audiobook

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyue

longyue_v2

Warm and magnetic female voice

Audiobook

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longnan

longnan_v2

Wise young man

Audiobook

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyuan

longyuan_v2

Warm and healing female voice

Audiobook

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longanrou

longanrou

Gentle Best Friend

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longqiang

longqiang_v2

Romantic and Charming Woman

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longhan

longhan_v2

A caring and dedicated man

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longxing

longxing_v2

Simple and friendly

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longfeifei

longfeifei_v2

Sweet and pampered girl

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longxiaocheng

longxiaocheng_v2

Magnetic low-pitched male voice

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longzhe

longzhe_v2

The Endearingly Awkward Man

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longyan

longyan_v2

Warm Spring Breeze Woman

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longtian

longtian_v2

Magnetic-Rational Man

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longze

longze_v2

Warm and energetic male voice

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longshao

longshao_v2

A motivated and ambitious man

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longhao

longhao_v2

Passionate and Melancholy Man

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longshen

kabuleshen_v2

Talented male singer voice

Social companion

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longjielidou

longjielidou_v2

Cheerful and Mischievous Boy

Child's voice

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longling

longling_v2

A girl with a naive and expressionless face

Child's voice

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longke

longke_v2

Sweet and innocent girl

Child's voice

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longxian

longxian_v2

Bold and Cute Girl

Child's voice

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longlaotie

longlaotie_v2

A Straight Shooter

Northeastern dialect

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longjiayi

longjiayi_v2

Intellectual Cantonese female voice

Cantonese

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longtao

longtao_v2

Positive Cantonese female voice

Cantonese

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longfei

longfei_v2

Passionate and magnetic male voice

Poetry recitation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Libai

libai_v2

Ancient Immortal Poet

Poetry recitation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longjin

longjin_v2

Elegant and gentle male voice

Poetry recitation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longshuo

longshuo_v2

A skilled professional

News broadcasting

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longxiaobai

longxiaobai_v2

Steady female announcer voice

News broadcasting

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

Longjing

longjing_v2

Typical female announcer voice

News broadcasting

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

loongstella

loongstella_v2

An astute and capable woman

News broadcasting

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

Yes

Yes

loongeva

loongeva_v2

Intellectual English Woman

Overseas marketing

British English

8 kHz/16 kHz/24 kHz

No

No

loongbrian

loongbrian_v2

Steady English male voice

Overseas marketing

British English

8 kHz/16 kHz/24 kHz

No

No

loongluna

loongluna_v2

British English female voice

Overseas marketing

British English

8 kHz/16 kHz/24 kHz

No

No

loongluca

loongluca_v2

British English male voice

Overseas marketing

British English

8 kHz/16 kHz/24 kHz

No

No

loongemily

loongemily_v2

British English female voice

Overseas marketing

British English

8 kHz/16 kHz/24 kHz

No

No

loongeric

loongeric_v2

British English male voice

Overseas marketing

British English

8 kHz/16 kHz/24 kHz

No

No

loongabby

loongabby_v2

American English female voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongannie

loongannie_v2

American English female voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongandy

loongandy_v2

American English male voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongava

loongava_v2

American English female voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongbeth

loongbeth_v2

American English female voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongbetty

loongbetty_v2

American English female voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongcindy

loongcindy_v2

American English female voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongcally

loongcally_v2

American English female voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongdavid

loongdavid_v2

American English male voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongdonna

loongdonna_v2

American English female voice

Overseas marketing

American English

8 kHz/16 kHz/24 kHz

No

No

loongkyong

loongkyong_v2

Korean female voice

Overseas marketing

Korean

8 kHz/16 kHz/24 kHz

No

No

loongtomoka

loongtomoka_v2

Japanese female voice

Overseas marketing

Japanese

8 kHz/16 kHz/24 kHz

No

No

loongtomoya

loongtomoya_v2

Japanese male voice

Overseas marketing

Japanese

8 kHz/16 kHz/24 kHz

No

No

CosyVoice-V1 voices

Name

Voice name

(voice parameter value)

Type

Scenario

Supported languages

Supported sample rates

Timestamp support

SSML support

Longchen

longchen

Dubbed film male voice

Dubbed film

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longxiong

longxiong

Dubbed film male voice

Dubbed film

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longyu

longyu

Mature older sister voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longjiao

longjiao

Mature older sister voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longmei

longmei

Gentle female voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longgui

longgui

Gentle female voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longping

longping

Male sports commentator voice

Sports commentary

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longpang

longpang

Male sports commentator voice

Sports commentary

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longwu

longwu

Nonsensical male voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longqi

longqi

Lively child's voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longxian

longxian_normal

Sunny female voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longfei

longfeifei

Mature female voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longxiu

longxiu

Young male voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longdachui

longdachui

Humorous male voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longjiajia

longjiajia

Approachable female voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longjiayi

longjiayi

Cantonese female voice

Chat, news broadcasting, audiobooks, in-car navigation

Cantonese and Cantonese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longtao

longtao

Cantonese female voice

Chat, news broadcasting, audiobooks, in-car navigation

Cantonese and Cantonese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longjiaxin

longjiaxin

Cantonese female voice

Chat, news broadcasting, audiobooks, in-car navigation

Cantonese and Cantonese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longcheng

longcheng

Sunny male voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longzhe

longzhe

Mature male voice

Chat, news broadcasting, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longnan

longnan

Young male voice

News broadcasting, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longyan

longyan

Friendly female voice

Intelligent customer service, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longqiang

longqiang

Languid female voice

Chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longhua

longhua

Lively girl

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longxing

longxing

Heartwarming female voice

Intelligent customer service, chat

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longjin

longjin

Young male voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longhan

longhan

Young male voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longtian

longtian

Overbearing CEO male voice

Chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longshuo

longshuo

Steady male voice

Intelligent customer service, news broadcasting, audiobooks,

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Stella2.0

loongstella

Brisk female voice

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longxiaocheng

longxiaocheng

Dapper gentleman

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longxiaoxia

longxiaoxia

Gentle female voice

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longxiaochun

longxiaochun

Gentle Sister

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longxiaobai

longxiaobai

Female chat voice

News broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longlaotie

longlaotie

Northeastern male voice

Chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longyue

longyue

Female storyteller voice

Intelligent customer service, news broadcasting, audiobooks,

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Bella2.0

loongbella

Female news anchor voice

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longshu

longshu

Male news anchor voice

News broadcasting, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longjing

longjing

Serious female voice

News broadcasting, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longmiao

longmiao

Classy female voice

Intelligent customer service, news broadcasting, chat, audiobooks, in-car navigation

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longlaoli

libai

Mandarin male voice

Poetry recitation, prose, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longwan

longwan

Mandarin female voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longke

longke

Lively girl

Intelligent customer service, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longling

longling

Lively girl

Intelligent customer service, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longshao

longshao

Energetic male voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longze

longze

Sunny male voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Longhao

longhao

Warm male voice

Intelligent customer service, news broadcasting, chat, audiobooks

Chinese and Chinese-English mixed

8 kHz/16 kHz/24 kHz

No

No

Endpoint

Access method

Description

URL

Public network access

All servers can use the public network access URL. The SDK uses the public network access URL by default.

China (Beijing): wss://nls-gateway-cn-beijing.aliyuncs.com/ws/v1

ECS internal network access

If you use an Alibaba Cloud ECS instance in the China (Beijing) region, you can use the internal network access URL. ECS instances in a classic network cannot access AnyTunnel and therefore cannot access the Voice Service over the internal network. To use AnyTunnel, create a VPC and access the service from within the VPC.

Note

Using the internal network access method does not incur data transfer costs for your ECS instance.

For more information about ECS network types, see Network types.

China (Beijing): ws://nls-gateway-cn-beijing-internal.aliyuncs.com:80/ws/v1

Interaction flow

image
  1. Authentication

    The client uses a token to authenticate when establishing a WebSocket connection with the server. For more information about how to obtain a token, see Overview.

  2. Configure parameters

    Before the client initiates a speech synthesis request, you can configure the synthesis parameters. You can set each parameter using the set method of the StreamInputTts object in the SDK. The parameters are described in the following table.

    Parameter

    Type

    Required

    Description

    appkey

    String

    Yes

    The AppKey of the project that you created in the console. To obtain an AppKey, go to the console.

    voice

    String

    Yes

    The voice of the speaker.

    format

    Enumeration/String

    No

    The audio coding format. It is an enumeration type in OutputFormatEnum. Valid values: .opus, .pcm, .wav, and .mp3. Default value: .pcm.

    sample_rate

    Enumeration/Integer

    No

    The audio sampling rate. Default value: 16,000 Hz. It is an enumeration type in SampleRateEnum. Valid values: SAMPLE_RATE_8K, SAMPLE_RATE_16K, SAMPLE_RATE_24K, and SAMPLE_RATE_48K.

    volume

    Integer

    No

    The volume of the speech. Valid values: 0 to 100. Default value: 50.

    speech_rate

    Integer

    No

    The speech rate. Valid values: -500 to 500. Default value: 0.

    pitch_rate

    Integer

    No

    The pitch of the speech. Valid values: -500 to 500. Default value: 0.

    bit_rate

    Integer

    No

    The bitrate of the audio. This parameter is valid only for OPUS encoding. Valid values: 6 to 510 kbps. Default value: 32.

    usage

    object

    No

    The billing information, which indicates the character data consumed by the current request.

    (One Chinese character is counted as two characters. One English letter, one punctuation mark, or one space between words is counted as one character.)

    enable_aigc_tag

    boolean

    No

    Specifies whether to add an invisible AIGC identifier to the generated audio. If you set this to true, the invisible identifier is embedded into the audio in a supported format (WAV, MP3, or Opus).

    Default value: false.

    aigc_propagator

    String

    No

    Sets the ContentPropagator field in the invisible AIGC identifier to identify the content propagator. This parameter is valid only when enable_aigc_tag is true.

    Default value: Your Alibaba Cloud UID.

    aigc_propagate_id

    String

    No

    Sets the PropagateID field in the invisible AIGC identifier to uniquely identify a specific propagation behavior. This parameter is valid only when enable_aigc_tag is true.

    Default value: The Task ID of the current speech synthesis request.

  3. Send the text for synthesis

    The client initiates a speech synthesis request and sends the text to be synthesized. You can set the text using the text parameter in startTts.

    Parameter

    Type

    Required

    Description

    text

    String

    Yes

    The text to be synthesized. The text must be UTF-8 encoded and cannot exceed 10,000 characters. Add a space between English words.

    Note

    The long-text speech synthesis service supports the SSML feature. SSML controls not only what is read, but also how it is read. You can control features such as sentence segmentation, pronunciation, speed, pauses, pitch, and volume. You can even add background music.

    For more information about how to use SSML, see SSML tags.

  4. Receive the synthesized data

    The server returns the synthesized binary voice data, which the SDK then receives and processes.

  5. End the synthesis

    After the speech synthesis is complete, the server sends a completion notification. The following code provides an example.

    {
        "header": {
            "message_id": "05450bf69c53413f8d88aed1ee60****",
            "task_id": "640bc797bb684bd6960185651307****",
            "namespace": "FlowingSpeechSynthesizer",
            "name": "SynthesisCompleted",
            "status": 20000000,
            "status_message": "GATEWAY|SUCCESS|Success."
        }
    }