API reference

更新时间:
复制 MD 格式

The streaming text-to-speech (TTS) feature converts input text into binary audio data. Streaming TTS provides better real-time performance than non-streaming TTS, which allows users to hear audio output with minimal delay as they enter text. This feature significantly improves the interactive experience, reduces wait times, and is ideal for scenarios such as word-by-word input or streaming text from large language models.

Billing and concurrency limits

Features

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

  • You can set the speech rate, pitch, and volume.

  • You can set voices for different scenarios and styles.

  • You can configure the speech rate, pitch, volume, and voice style only before the input stream starts.

  • In a single session, you can send text in multiple segments and receive the corresponding audio. The synthesized audio can be played in real time with low latency.

    To play the audio in real time, you can use an audio player that supports streaming playback, such as ffmpeg, pyaudio (Python), AudioFormat (Java), or MediaSource (JavaScript).

  • In a single streaming TTS session, a synthesis request cannot exceed 10,000 characters, and the total number of characters for the session cannot exceed 100,000. A character is defined as a Chinese character, an English letter, a punctuation mark, or a space.

  • Supports only UTF-8 encoded text input.

  • Does not support SSML tags.

Voice list

Note

To listen to more voice samples, you can visit the Speech Synthesis product page. The product page provides audio samples for most voices. If a voice is not available for preview on the page, you can call the API to listen to a sample. For more information, see Java SDK and C++ SDK.

Name

voice parameter value

Type

Scenario

Supported languages

Supported sample rates (Hz)

Word/sentence-level timestamp support

Erhua support

Voice quality

Abin

abin

Cantonese-accented Mandarin

Conversational digital human

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

No

No

Standard Edition

Zhixiaobai

zhixiaobai

Mandarin female voice

Conversational digital human

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

No

Yes

Standard Edition

Zhixiaoxia

zhixiaoxia

Mandarin female voice

Conversational digital human

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

No

Yes

Standard Edition

Zhixiaomei

zhixiaomei

Mandarin female voice

Live streaming digital human

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz

Yes

Yes

Standard Edition

Zhigui

zhigui

Mandarin female voice

Live streaming digital human

Supports Chinese and mixed Chinese-English scenarios

8K/16K

Yes

Yes

Standard Edition

Zhishuo

zhishuo

Mandarin male voice

Customer service digital human

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz

Yes

Yes

Standard Edition

Aixia

aixia

Mandarin female voice

Customer service digital human

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz

Yes

Yes

Standard Edition

Cally

cally

American English female voice

Spoken English conversational digital human

Supports only pure English scenarios

8K or 16K

Yes

Yes

Standard Edition

Zhifeng_emo

zhifeng_emo

Multi-emotional male voice

General

Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz

Yes

Yes

Standard Edition

Zhibing_emo

zhibing_emo

Multi-emotional male voice

Common scenarios

Pure Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

Yes

Standard Edition

Zhimiao_emo

zhimiao_emo

Multi-emotional female voice

Chinese-English

Chinese and English scenarios

8K or 16K

Yes

Yes

Standard Edition

Zhimi_emo

zhimi_emo

Multi-emotional female voice

General

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Standard Edition

Zhiyan_emo

zhiyan_emo

Multi-emotional female voice

General scenarios

Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

No

Standard Edition

Zhibei_emo

zhibei_emo

Multi-emotional child's voice

General

Chinese and mixed Chinese-English scenarios

8K/16K

Yes

No

Standard Edition

Zhitian_emo

zhitian_emo

Multi-emotional female voice

Common Scenarios

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Standard Edition

Xiaoyun

xiaoyun

Standard female voice

General

Chinese and mixed Chinese-English scenarios

8K or 16K

No

No

Lite Edition

Xiaogang

xiaogang

Standard male voice

General

Chinese and mixed Chinese-English scenarios

8K or 16K

No

No

Lite Edition

Ruoxi

ruoxi

Gentle female voice

Common scenarios

Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Siqi

siqi

Gentle female voice

Common scenarios

Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

Sijia

sijia

Standard female voice

General

Chinese and mixed Chinese-English scenarios

8K, 16K, or 24K

No

No

Standard Edition

Sicheng

sicheng

Standard male voice

Common scenarios

Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

Aiqi

aiqi

Gentle female voice

General

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Standard Edition

Aijia

aijia

Standard female voice

General

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Standard Edition

Aicheng

aicheng

Standard male voice

General

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Standard Edition

Aida

aida

Standard male voice

General

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Standard Edition

Ninger

ninger

Standard female voice

Common scenarios

Pure Chinese scenarios

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Ruilin

ruilin

Standard female voice

General scenarios

Pure Chinese scenarios

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Siyue

siyue

Gentle female voice

Customer service

Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

Aiya

aiya

Strict female voice

Customer service

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Standard Edition

Aimei

aimei

Sweet female voice

Customer service

Chinese and mixed Chinese-English scenarios

8K/16K

Yes

No

Standard Edition

Aiyu

aiyu

Natural female voice

Customer service

Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

No

Standard Edition

Aiyue

aiyue

Gentle female voice

Customer service

Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

No

Standard Edition

Aijing

aijing

Strict female voice

Customer service

Chinese and mixed Chinese-English scenarios

8 KB or 16 KB

Yes

No

Standard Edition

Xiaomei

xiaomei

Sweet female voice

Customer service

Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Aina

aina

Zhejiang-accented Mandarin female voice

Customer service

Pure Chinese scenarios

8K or 16K

Yes

No

Standard Edition

Yina

yina

Zhejiang-accented Mandarin female voice

Customer service

Pure Chinese scenarios

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Sijing

sijing

Strict female voice

Customer service

Pure Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

Sitong

sitong

Child's voice

Child's voice

Pure Chinese scenarios

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Xiaobei

xiaobei

Young female voice

Child's voice

Pure Chinese scenarios

8K, 16K, or 24K

Yes

No

Standard Edition

Aitong

aitong

Child's voice

Child's voice

Pure Chinese scenarios

8K or 16K

Yes

No

Standard Edition

Aiwei

aiwei

Young female voice

Child's voice

Pure Chinese scenarios

8 K/16 K

Yes

No

Standard Edition

Aibao

aibao

Young female voice

Child's voice

Pure Chinese scenarios

8 kHz/16 kHz

Yes

No

Standard Edition

Harry

harry

British English male voice

English Scenario

English scenario

8 K/16 K

No

No

Standard Edition

Abby

abby

American English female voice

English-language scenario

English

8K or 16K

Yes

No

Standard Edition

Andy

andy

American English male voice

English scenario

English-language scenario

8 K/16 K

Yes

No

Standard Edition

Eric

eric

British English male voice

Scenario in English

English Scenario

8K or 16K

Yes

No

Standard Edition

Emily

emily

British English female voice

Scenario: English

English Scenario

8 K/16 K

Yes

No

Standard Edition

Luna

luna

British English female voice

English Scenario

English Scenario

8 K/16 K

Yes

No

Standard Edition

Luca

luca

British English male voice

English-language scenario

English scenario

8K or 16K

Yes

No

Standard Edition

Wendy

wendy

British English female voice

English

English

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

William

william

British English male voice

English Scenario

English Scenario

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Olivia

olivia

British English female voice

English-language scenario

English scenario

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Shanshan

shanshan

Cantonese female voice

Dialect

Standard Written Cantonese (Simplified) and mixed Cantonese-English scenarios

8 kHz/16 kHz/24 kHz

No

No

Standard Edition

Aiyuan

aiyuan

Trusted Advisor

Literary

Chinese and mixed Chinese-English scenarios

8K/16K

Yes

Yes

Premium Edition

Aiying

aiying

Soft and cute child's voice

Literary scenario

Chinese and mixed Chinese-English scenarios

8K/16K

Yes

Yes

Premium Edition

Aixiang

aixiang

Magnetic male voice

Literary

Chinese and mixed Chinese-English scenarios

8K / 16K

Yes

Yes

Premium Edition

Aimo

aimo

Emotional male voice

Literature-based scenario

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Aiye

aiye

Young male voice

Literary

Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

Yes

Premium Edition

Aiting

aiting

Radio female voice

Literature scenario

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Aifan

aifan

Emotional female voice

Literature-based scenario

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Lydia

lydia

Bilingual English-Chinese female voice

English

English and mixed English-Chinese scenarios

8K or 16K

Yes

No

Standard Edition

Xiaoyue

chuangirl

Sichuanese female voice

Dialect

Chinese and mixed Chinese-English scenarios

8K or 16K

No

No

Standard Edition

Aishuo

aishuo

Natural male voice

Customer service

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Standard Edition

Qingqing

qingqing

Taiwanese Mandarin female voice

Dialect

Pure Chinese scenarios

8 K/16 K

No

No

Standard Edition

Cuijie

cuijie

Northeastern Mandarin female voice

Dialect

Pure Chinese scenarios

8K or 16K

Yes

Yes

Standard Edition

Xiaoze

xiaoze

Hunanese heavy-accented male voice

Dialect

Pure Chinese scenarios

8K or 16K

No

No

Standard Edition

Ainan

ainan

Advertisement male voice

Literature scenario

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Aihao

aihao

News male voice

Literary

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Aiming

aiming

Humorous male voice

Literary

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Aixiao

aixiao

News female voice

Literary

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Aichu

aichu

Gourmet-style male voice

Literary scenario

Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

Yes

Premium Edition

Aiqian

aiqian

News female voice

Literature scenario

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Zhi Xiang

tomoka

Japanese female voice

Multilingual

Pure Japanese scenarios

8K/16K

Yes

No

Standard Edition

Tomoya

tomoya

Japanese male voice

Multilingual

Pure Japanese scenarios

8K or 16K

Yes

No

Standard Edition

Annie

annie

American English female voice

English Scenario

Pure English scenarios

8K/16K

Yes

No

Standard Edition

Aishu

aishu

News male voice

Literary

Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Premium Edition

Airu

airu

Newscast female voice

Literature scenario

Chinese and mixed Chinese-English scenarios

8K/16K

Yes

Yes

Premium Edition

Jiajia

jiajia

Cantonese female voice

Dialect scenarios

Standard Written Cantonese (Simplified) and mixed Cantonese-English scenarios

8K or 16K

Yes

No

Standard Edition

Indah

indah

Indonesian female voice

Multilingual

Pure Indonesian scenarios

8 K/16 K

No

No

Standard Edition

Peach

taozi

Cantonese female voice

Dialect

Supports Standard Written Cantonese (Simplified) and mixed Cantonese-English scenarios

8 kHz/16 kHz

Yes

No

Standard Edition

Sales Associate

guijie

Friendly female voice

General

Supports Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Standard Edition

Stella

stella

Intellectual female voice

Common scenarios

Supports Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Standard Edition

Stanley

stanley

Calm male voice

General

Supports Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Standard Edition

Kenny

kenny

Calm male voice

General scenarios

Supports Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

Yes

Standard Edition

Rosa

rosa

Natural female voice

General

Supports Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

Yes

Standard Edition

Farah

farah

Malay female voice

Multilingual

Supports only pure Malay scenarios

8K/16K

No

No

Standard Edition

Mashu

mashu

Children's drama male voice

General

General

8K/16K

Yes

No

Standard Edition

Zhiqi

zhiqi

Gentle female voice

Ultra-high definition

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

No

Premium Edition

Zhichu

zhichu

Gourmet-style male voice

Ultra-high definition

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

Yes

Premium Edition

Xiaoxian

xiaoxian

Friendly female voice

Live streaming

Supports Chinese and mixed Chinese-English scenarios

8K/16K

Yes

Yes

Standard Edition

Yuer

yuer

Children's drama female voice

Common scenarios

Supports only pure Chinese scenarios

8K or 16K

Yes

No

Standard Edition

Maoxiaomei

maoxiaomei

Energetic female voice

Live streaming

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz

Yes

Yes

Standard Edition

Zhixiang

zhixiang

Magnetic male voice

Ultra-high definition

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

No

Premium Edition

Zhijia

zhijia

Standard female voice

Ultra-high definition

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

No

Premium Edition

Zhinan

zhinan

Advertisement male voice

Ultra-high definition

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

No

Premium Edition

Zhiqian

zhiqian

News female voice

Ultra-high definition

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

No

Premium Edition

Zhiru

zhiru

Newscast female voice

Ultra-high definition

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

No

Premium Edition

Zhide

zhide

Newscast male voice

Ultra-high-definition scenarios

Supports Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

No

Premium Edition

Zhifei

zhifei

Passionate commentary

Ultra-high-definition scenarios

Supports Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Premium Edition

Aifei

aifei

Passionate commentary

Live streaming

Supports Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

Yes

Standard Edition

Yaqun

yaqun

Store broadcast

Live streaming

Supports Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Standard Edition

Qiaowei

qiaowei

Store broadcast

Live streaming

Supports Chinese and mixed Chinese-English scenarios

8K/16K

Yes

Yes

Standard Edition

Dahu

dahu

Northeastern Mandarin male voice

Scenarios with dialects

Supports Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Standard Edition

ava

ava

American English (Female)

English scenario

Supports only pure English scenarios

8K or 16K

Yes

No

Standard Edition

Zhilun

zhilun

Suspense narration

Ultra-high definition

Supports Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

No

Premium Edition

Ailun

ailun

Suspense narration

Live streaming

Supports Chinese and mixed Chinese-English scenarios

8K or 16K

Yes

Yes

Standard Edition

Jielidou

jielidou

Soothing child's voice

Child's voice

Supports only pure Chinese scenarios

8 KB or 16 KB

Yes

Yes

Standard Edition

Zhiwei

zhiwei

Young female voice

Ultra-high definition

Supports only pure Chinese scenarios

8 kHz/16 kHz/24 kHz/48 kHz

Yes

No

Premium Edition

Laotie

laotie

Northeastern buddy

Live streaming

Supports only pure Chinese scenarios

8K/16K

Yes

Yes

Standard Edition

Laomei

laomei

Hawking female voice

Live streaming

Supports only pure Chinese scenarios

8K/16K

Yes

Yes

Standard Edition

Aikan

aikan

Tianjin dialect male voice

Scenarios for dialects

Supports only pure Chinese scenarios

8K or 16K

Yes

Yes

Standard Edition

Tala

tala

Filipino female voice

Multilingual

Supports only Filipino scenarios

8K or 16K

No

No

Standard Edition

Zhitian

zhitian

Sweet female voice

Common scenarios

Supports Chinese and mixed Chinese-English scenarios

8 K/16 K

Yes

No

Premium Edition

Zhiqing

zhiqing

A girl speaking a dialect from Taiwan (China)

Dialect

Supports only pure Chinese scenarios

8K or 16K

Yes

No

Premium Edition

Tien

tien

Vietnamese female voice

Multilingual

Supports only Vietnamese scenarios

8 K / 16 K

No

No

Standard Edition

Becca

becca

American English customer service female voice

American English

Supports only pure English scenarios

8K or 16K

No

No

Standard Edition

Kyong

Kyong

Korean female voice

Korean

Korean

8K/16K

No

No

Standard Edition

masha

masha

Russian female voice

Russian

Russian

8K or 16K

No

No

Standard Edition

camila

camila

Spanish female voice

Spanish

Spanish

8 kHz/16 kHz

No

No

Standard Edition

perla

perla

Italian female voice

Italian scenario

Italian

8 kHz/16 kHz

No

No

Standard Edition

Zhimao

zhimao

Mandarin female voice

Live streaming

Chinese

8 kHz/16 kHz

Yes

No

Standard Edition

Zhiyuan

zhiyuan

Mandarin female voice

General

Chinese

8 kHz/16 kHz

Yes

No

Standard Edition

Zhiya

zhiya

Mandarin female voice

Customer service

Chinese

8 kHz/16 kHz

Yes

No

Standard Edition

Zhiyue

zhiyue

Mandarin female voice

Common scenarios

Chinese

8 kHz/16 kHz

Yes

No

Standard Edition

Zhida

zhida

Mandarin male voice

Common scenarios

Chinese and mixed Chinese-English scenarios

8 kHz/16 kHz

Yes

No

Standard Edition

Zhistella

zhistella

Mandarin female voice

Common scenarios

Chinese

8 kHz/16 kHz

Yes

No

Standard Edition

Kelly

kelly

Hong Kong Cantonese female voice

Dialect

Hong Kong Cantonese

8 kHz/16 kHz

Yes

No

Standard Edition

clara

clara

French female voice

General

French

8 kHz/16 kHz

No

No

Standard Edition

hanna

hanna

German female voice

General

German

8 kHz/16 kHz

No

No

Standard Edition

waan

waan

Thai female voice

General scenarios

Thai

8 kHz/16 kHz

No

No

Standard Edition

betty

betty

American English female voice

General scenarios

American English

8 kHz/16 kHz

Yes

No

Standard Edition

beth

beth

American English female voice

Common scenarios

American English

8 kHz/16 kHz

Yes

No

Standard Edition

cindy

cindy

American English female voice

Common scenarios

American English

8 kHz/16 kHz

Yes

No

Standard Edition

donna

donna

American English female voice

Common Scenarios

American English

8 kHz/16 kHz

Yes

No

Standard Edition

eva

eva

American English female voice

General

American English

8 kHz/16 kHz

Yes

No

Standard Edition

brian

brian

American English male voice

General

American English

8 kHz/16 kHz

Yes

No

Standard Edition

david

david

American English male voice

Common Scenarios

American English

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

abby_ecmix

abby_ecmix

American English female voice

Common scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

annie_ecmix

annie_ecmix

American English female voice

Common scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

andy_ecmix

andy_ecmix

American English male voice

Common scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

ava_ecmix

ava_ecmix

American English female voice

Common scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

betty_ecmix

betty_ecmix

American English female voice

Common scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

beth_ecmix

beth_ecmix

American English female voice

General

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

brian_ecmix

brian_ecmix

American English male voice

Common scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

cindy_ecmix

cindy_ecmix

American English female voice

Common scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

cally_ecmix

cally_ecmix

American English female voice

Common scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

donna_ecmix

donna_ecmix

American English female voice

General

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

david_ecmix

david_ecmix

American English male voice

General

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

eva_ecmix

eva_ecmix

American English female voice

General scenarios

English and mixed English-Chinese scenarios

8 kHz/16 kHz/24 kHz

Yes

No

Standard Edition

Intelligent access to the nearest region

Streaming TTS supports intelligent access to the nearest region. The domain name for this feature is nls-gateway.aliyuncs.com.

For optimal performance, we recommend that you use intelligent access to the nearest region. This feature automatically routes requests to the server in the nearest region based on the client's geographical location. For example, if you initiate a request from the China (Beijing) region, the system automatically routes it to a server in the China (Beijing) region. This is equivalent to using the region-specific domain name nls-gateway-cn-beijing.aliyuncs.com.

Service endpoint

Access type

Description

URL

Public network access

All servers can be accessed over the public network. The public access URL is set by default in the software development kit (SDK).

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 access URL. The classic network of an ECS instance cannot access AnyTunnel. This means you cannot access the Voice Service over the internal network. To use AnyTunnel, create a Virtual Private Cloud (VPC) and access the service from within the VPC.

Note

Using the internal access method does not incur public data transfer costs for the 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 the WebSocket connection with the server. For more information, see Overview of obtaining a token.

  2. Start synthesis

    The client initiates a speech synthesis request and configures parameters in the request message. You can set each parameter using the `set` method of the `FlowingSpeechSynthesizer` object in the SDK. The following table describes the parameters.

    Parameter

    Type

    Required

    Description

    appkey

    String

    Yes

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

    voice

    String

    Yes

    The speaker's voice.

    format

    Enumerated type/String

    No

    The audio encoding format. It is an enumerated type in `OutputFormatEnum`: .pcm, .wav, and .mp3. The default value is .pcm.

    sample_rate

    Enumerated type/Integer

    No

    The audio sample rate. The default value is 16000 Hz. It is an enumerated type in `SampleRateEnum`: SAMPLE_RATE_8K, SAMPLE_RATE_16K, SAMPLE_RATE_24K, SAMPLE_RATE_48K.

    volume

    Integer

    No

    The playback volume. The range is 0 to 100. The default value is 50.

    speech_rate

    Integer

    No

    The speech rate. The range is -500 to 500. The default value is 0.

    pitch_rate

    Integer

    No

    The speech pitch. The range is -500 to 500. The default value is 0.

    enable_subtitle

    Boolean

    No

    Enables word-level timestamps. For more information about how to use this feature, see Timestamp feature.

    usage

    object

    No

    Metering information that indicates the character data consumed by the 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. Receive synthesized data

    The server returns the synthesized audio as binary data. The SDK then receives and processes this binary data.

  4. End synthesis

    After the speech synthesis is complete, the server sends a completion event 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."
        }
    }