API reference

更新时间:
复制 MD 格式

Speech synthesis lets you convert input text into binary speech data.

Function introduction

The NUI software development kit (SDK) provides a compact toolkit and robust state management. It offers both end-to-end voice capabilities and individual features through a unified API to meet a variety of user needs.

The speech synthesis feature supports the following capabilities:

  • Outputs data in PCM and MP3 encoding formats.

  • Lets you set the speech rate, pitch, and volume.

  • Lets you set the voice type, as shown in the following table.

    Name

    voice parameter value

    Type

    Scenarios

    Supported languages

    Supported sample rates (Hz)

    Supports timestamp (word-level phoneme boundary) API

    Support for erhua

    Voice quality

    Zhimiao_Multi-emotional

    zhimiao_emo

    Multi-emotional female voice

    Chinese-English scenarios

    Chinese and English scenarios

    8K or 16K

    Yes

    Yes

    Standard Edition

    Zhimi_Multi-emotional

    zhimi_emo

    Multi-emotional female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Zhiyan_Multi-emotional

    zhiyan_emo

    Multi-emotional female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Zhibei_Multi-emotional

    zhibei_emo

    Multi-emotional child voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz

    Yes

    No

    Standard Edition

    Zhitian_Multi-emotional

    zhitian_emo

    Multi-emotional female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Xiaoyun

    xiaoyun

    Standard female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8K or 16K

    No

    No

    Lite Edition

    Xiaogang

    xiaogang

    Standard male voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8 K/16 K

    No

    No

    Lite Edition

    Ruoxi

    ruoxi

    Gentle female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Siqi

    siqi

    Gentle female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz/24 kHz

    Yes

    No

    Standard Edition

    Sijia

    sijia

    Standard female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Sicheng

    sicheng

    Standard male voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz/24 kHz

    Yes

    No

    Standard Edition

    Aiqi

    aiqi

    Gentle female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Aijia

    aijia

    Standard female voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Aicheng

    aicheng

    Standard male voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8 K/16 K

    Yes

    No

    Standard Edition

    Aida

    aida

    Standard male voice

    General scenarios

    Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Ninger

    ninger

    Standard female voice

    General scenarios

    Chinese-only scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Ruilin

    ruilin

    Standard female voice

    General scenarios

    Chinese-only scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Siyue

    siyue

    Gentle female voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz/24 kHz

    Yes

    No

    Standard Edition

    Aiya

    aiya

    Stern female voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8K / 16K

    Yes

    No

    Standard Edition

    Aixia

    aixia

    Friendly female voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Aimei

    aimei

    Sweet female voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz

    Yes

    No

    Standard Edition

    Aiyu

    aiyu

    Natural female voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8 K/16 K

    Yes

    No

    Standard Edition

    Aiyue

    aiyue

    Gentle female voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Aijing

    aijing

    Stern female voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8 K/16 K

    Yes

    No

    Standard Edition

    Xiaomei

    xiaomei

    Sweet female voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Aina

    aina

    Zhejiang Mandarin female voice

    Customer service scenarios

    Chinese-only scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Yina

    yina

    Zhejiang Mandarin female voice

    Customer service scenarios

    Chinese-only scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Sijing

    sijing

    Stern female voice

    Customer service scenarios

    Chinese-only scenarios

    8 kHz/16 kHz/24 kHz

    Yes

    No

    Standard Edition

    Sitong

    sitong

    Child voice

    Child voice scenarios

    Chinese-only scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Xiaobei

    xiaobei

    Young female voice

    Child voice scenarios

    Chinese-only scenarios

    8 kHz/16 kHz/24 kHz

    Yes

    No

    Standard Edition

    Aitong

    aitong

    Child voice

    Child voice scenarios

    Chinese-only scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Aiwei

    aiwei

    Young female voice

    Child voice scenarios

    Chinese-only scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Aibao

    aibao

    Young female voice

    Child voice scenarios

    Chinese-only scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Harry

    harry

    British English male voice

    English scenarios

    English scenarios

    8 K/16 K

    No

    No

    Standard Edition

    Abby

    abby

    American English female voice

    English scenarios

    English scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Andy

    andy

    American English male voice

    English scenarios

    English scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Eric

    eric

    British English male voice

    English scenarios

    English scenarios

    8 K/16 K

    Yes

    No

    Standard Edition

    Emily

    emily

    British English female voice

    English scenarios

    English scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Luna

    luna

    British English female voice

    English scenarios

    English scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Luca

    luca

    British English male voice

    English scenarios

    English scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Wendy

    wendy

    British English female voice

    English scenarios

    English scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    William

    william

    British English male voice

    English scenarios

    English scenarios

    8 K/16 K/24 K

    No

    No

    Standard Edition

    Olivia

    olivia

    British English female voice

    English scenarios

    English scenarios

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Shanshan

    shanshan

    Cantonese female voice

    Dialect scenarios

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

    8 kHz/16 kHz/24 kHz

    No

    No

    Standard Edition

    Xiaoyue

    chuangirl

    Sichuanese female voice

    Dialect scenarios

    Chinese and Chinese-English mixed scenarios

    8 kHz/16 kHz

    No

    No

    Standard Edition

    Lydia

    lydia

    English-Chinese bilingual female voice

    English scenarios

    English and English-Chinese mixed scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Aishuo

    aishuo

    Natural male voice

    Customer service scenarios

    Chinese and Chinese-English mixed scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Qingqing

    qingqing

    Taiwanese female voice (Taiwan, China)

    Dialect scenarios

    Chinese scenarios

    8 K/16 K

    No

    No

    Standard Edition

    Cuijie

    cuijie

    Northeastern Mandarin female voice

    Dialect scenarios

    Chinese scenarios

    8K or 16K

    Yes

    Yes

    Standard Edition

    Xiaoze

    xiaoze

    Hunan-accented male voice

    Dialect scenarios

    Chinese scenarios

    8 K / 16 K

    No

    No

    Standard Edition

    Zhixiang

    tomoka

    Japanese female voice

    Multilingual scenarios

    Japanese Scenario

    8K/16K

    Yes

    No

    Standard Edition

    Tomoya

    tomoya

    Japanese male voice

    Multilingual scenarios

    Japanese scenarios

    8 K/16 K

    Yes

    No

    Standard Edition

    Annie

    annie

    American English female voice

    English scenarios

    English scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Jiajia

    jiajia

    Cantonese female voice

    Dialect scenarios

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

    8K or 16K

    Yes

    No

    Standard Edition

    Indah

    indah

    Indonesian female voice

    Multilingual scenarios

    Indonesian-only scenarios

    8K/16K

    No

    No

    Standard Edition

    Peach

    taozi

    Cantonese female voice

    Dialect scenarios

    Supports standard Cantonese (Simplified Chinese) and Cantonese-English mixed scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Guijie

    guijie

    Friendly female voice

    General scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K/16K

    Yes

    Yes

    Standard Edition

    Stella

    stella

    Sophisticated female voice

    General scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8 K/16 K

    Yes

    Yes

    Standard Edition

    Stanley

    stanley

    Calm male voice

    General scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K/16K

    Yes

    Yes

    Standard Edition

    Kenny

    kenny

    Calm male voice

    General scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K / 16K

    Yes

    Yes

    Standard Edition

    Rosa

    rosa

    Natural female voice

    General scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    Yes

    Standard Edition

    Farah

    farah

    Malay female voice

    Multilingual scenarios

    Supports Malay-only scenarios

    8 K/16 K

    No

    No

    Standard Edition

    Mashu

    mashu

    Children's drama male voice

    General scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Xiaoxian

    xiaoxian

    Friendly female voice

    Livestreaming scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8 KB/16 KB

    Yes

    Yes

    Standard Edition

    Yuer

    yuer

    Children's drama female voice

    General scenarios

    Supports Chinese-only scenarios

    8K/16K

    Yes

    No

    Standard Edition

    Maoxiaomei

    maoxiaomei

    Energetic female voice

    Livestreaming scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K/16K

    Yes

    Yes

    Standard Edition

    Aifei

    aifei

    Passionate commentary

    Livestreaming scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    Yes

    Standard Edition

    Yaqun

    yaqun

    Shopping mall announcement

    Livestreaming scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8 K/16 K

    Yes

    Yes

    Standard Edition

    Qiaowei

    qiaowei

    Shopping mall announcement

    Livestreaming scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    Yes

    Standard Edition

    Dahu

    dahu

    Northeastern Mandarin male voice

    Dialect scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8K or 16K

    Yes

    Yes

    Standard Edition

    ava

    ava

    American English female voice

    English scenarios

    Supports English-only scenarios

    8K or 16K

    Yes

    No

    Standard Edition

    Ailun

    ailun

    Suspenseful commentary

    Livestreaming scenarios

    Supports Chinese and Chinese-English mixed scenarios

    8 K/16 K

    Yes

    Yes

    Standard Edition

    Jielidou

    jielidou

    Soothing child voice

    Child voice scenarios

    Supports Chinese-only scenarios

    8 K / 16 K

    Yes

    Yes

    Standard Edition

    Laotie

    laotie

    Northeastern Buddy

    Livestreaming scenarios

    Supports Chinese-only scenarios

    8K or 16K

    Yes

    Yes

    Standard Edition

    Laomei

    laomei

    Hawking female voice

    Livestreaming scenarios

    Supports Chinese-only scenarios

    8K or 16K

    Yes

    Yes

    Standard Edition

    Aikan

    aikan

    Tianjin dialect male voice

    Dialect scenarios

    Supports Chinese-only scenarios

    8 K / 16 K

    Yes

    Yes

    Standard Edition

    Tala

    tala

    Filipino female voice

    Multilingual scenarios

    Supports Filipino-only scenarios

    8 K / 16 K

    No

    No

    Standard Edition

    Tien

    tien

    Vietnamese female voice

    Multilingual scenarios

    Supports Vietnamese-only scenarios

    8K/16K

    No

    No

    Standard Edition

    Becca

    becca

    American English customer service female voice

    American English

    Supports English-only scenarios

    8 K / 16 K

    No

    No

    Standard Edition

    Kyong

    Kyong

    Korean female voice

    Korean scenarios

    Korean

    8K/16K

    No

    No

    Standard Edition

    masha

    masha

    Russian female voice

    Russian scenarios

    Russian

    8K or 16K

    No

    No

    Standard Edition

Limitations

  • The input text must be UTF-8 encoded.

  • The input text cannot exceed 300 characters. Content that exceeds this limit is truncated.

Endpoints

Access type

Description

URL

Public network access (default region: China (Shanghai))

All servers can use the public network access URL. The public network access URL is set by default in the SDK.

  • China (Shanghai): wss://nls-gateway-cn-shanghai.aliyuncs.com/ws/v1

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

  • China (Shenzhen): wss://nls-gateway-cn-shenzhen.aliyuncs.com/ws/v1

ECS private network access

If you use Alibaba Cloud ECS instances in the China (Shanghai), China (Beijing), or China (Shenzhen) regions, you can use the private network access URL. ECS instances in the classic network cannot access AnyTunnel. This means they cannot access Voice Service over the private network. To use AnyTunnel, create a VPC and access the service from within the VPC.

Important
  • Using private network access does not incur data transfer costs for your ECS instance.

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

  • China (Shanghai): ws://nls-gateway-cn-shanghai-internal.aliyuncs.com:80/ws/v1

  • Beijing: ws://nls-gateway-cn-beijing-internal.aliyuncs.com:80/ws/v1

  • China (Shenzhen): ws://nls-gateway-cn-shenzhen-internal.aliyuncs.com:80/ws/v1

Interaction flow

image
  1. Authentication

    A client uses a token for authentication when it establishes a WebSocket connection with the server. For more information, see Obtaining a Token Overview.

    The initialization parameters are as follows:

    Parameter

    Type

    Required

    Description

    workspace

    String

    Yes

    The path of the working directory. The SDK reads configuration files from this path.

    app_key

    String

    Yes

    The AppKey of the project created in the console.

    token

    String

    Yes

    Make sure the token is valid and has not expired. Set the token during initialization or update it later using parameters.

    device_id

    String

    Yes

    The device ID. It must uniquely identify a device, such as a MAC address, SN, or UniquePseudoID.

  2. Start synthesis

    The client sends a speech synthesis request. You can set the parameters in the request message using the `setparamTts` method in the SDK. The parameters are described as follows:

    Parameter

    Type

    Required

    Description

    app_key

    String

    Yes

    The AppKey of the project created in the console.

    token

    String

    No

    If an update is required, you can configure the settings.

    direct_host

    String

    No

    Lets the client perform DNS resolution and then use the IP address for access.

    font_name

    String

    No

    The voice font. The default value is `xiaoyun`.

    encode_type

    String

    No

    The audio encoding format. Default value: `pcm`. Supported formats: `pcm`, `wav`, and `mp3`.

    sample_rate

    String

    No

    The audio sample rate. Default value: 16000.

    volume

    String

    No

    The volume. Valid values: 0 to 2. Default value: 1.0.

    speed_level

    String

    No

    The speech rate. Valid values: 0 to 2. Default value: 1.0. A larger value indicates a faster rate.

    pitch_level

    String

    No

    The pitch. Valid values: -500 to 500. Default value: 0. A larger value indicates a higher pitch.

    enable_subtitle

    String

    No

    The switch for the word-level phoneme boundary feature. This parameter is valid only for voice fonts that support the word-level phoneme boundary API.

    • 1: On.

    • 0: disables the feature.

    mode_type

    String

    Yes

    Sets the online speech synthesis mode. For speech synthesis, you must set this parameter to 2. Otherwise, the feature will not work.

    tts_version

    String

    Yes

    Sets the speech synthesis mode.

    • 1: Long text speech synthesis (more than 300 characters)

    • 0: Short text speech synthesis (300 characters or less)

    custom_params

    String

    No

    To set parameters that are supported by the interaction protocol but not mentioned in this API reference, use this universal parameter. The key is `custom_params` and the value is a JSON string. For information about how to set this parameter, see the code sample.

  3. Receive and synthesize data

    The server returns the synthesized binary speech data. The SDK receives and processes the binary data.

  4. End synthesis

    After the speech synthesis is complete, the server sends an event notification.

Error codes

If a speech synthesis error occurs, the SDK reports a `TTS_EVENT_ERROR` event and provides an error message, as shown in the following tables.

General-purpose error codes

Status code

Status message

Cause

Solution

40000000

The default client error code. This code corresponds to multiple error messages.

Invalid parameters or call logic was used.

Compare your code with the sample code in the official documentation to test and verify it.

40000001

The token 'xxx' has expired.

The token 'xxx' is invalid

Invalid parameters or call logic was used. This is a general-purpose client error code that usually indicates an incorrect token, such as an expired or invalid token.

Compare your code with the sample code in the official documentation to test and verify it.

40000002

Gateway:MESSAGE_INVALID:Can't process message in state'FAILED'!

The message is invalid or incorrect.

Compare your code with the sample code in the official documentation to test and verify it.

40000003

PARAMETER_INVALID

Failed to decode url params

The parameters passed by the user are incorrect. This error is common for RESTful API calls.

Compare your code with the sample code in the official documentation to test and verify it.

40000005

Gateway:TOO_MANY_REQUESTS:Too many requests!

Too many concurrent requests.

If you are using the Free Edition, you can upgrade to a commercial version to increase the concurrency.

If you are already using a commercial version, you can purchase a concurrency resource plan to increase your concurrency quota.

40000009

Invalid wav header!

The message header is invalid.

If you send a WAV audio file and set the format parameter to wav, check whether the WAV header of the audio file is correct. If the header is incorrect, the server may reject the request.

40000009

Too large wav header!

The WAV header of the transmitted audio is invalid.

You can send the audio stream in a format such as PCM or OPUS. If you use the WAV format, make sure that the WAV header of the audio file contains the correct data length.

40000010

Gateway:FREE_TRIAL_EXPIRED:The free trial has expired!

The trial period has ended, and the commercial version is not activated or your account has an overdue payment.

You can log on to the console to check the service activation status and your account balance.

40010001

Gateway:NAMESPACE_NOT_FOUND:RESTful url path illegal

The operation or parameter is not supported.

Check whether the parameters passed in the call are consistent with the requirements in the official documentation. You can compare them with the error message to identify and set the correct parameters.

For example, if you are using a curl command to make a RESTful API request, check whether the URL you constructed is valid.

40010003

Gateway:DIRECTIVE_INVALID:[xxx]

A general-purpose client-side error code.

This error indicates that the client passed an incorrect parameter or instruction. Detailed error messages are available for different operations. You can refer to the corresponding documentation to set the parameters correctly.

40010004

Gateway:CLIENT_DISCONNECT:Client disconnected before task finished!

The client actively terminated the connection before the request was processed.

None. Alternatively, you can close the connection after the server responds.

40010005

Gateway:TASK_STATE_ERROR:Got stop directive while task is stopping!

The client sent a message instruction that is not currently supported.

Compare your code with the sample code in the official documentation to test and verify it.

40020105

Meta:APPKEY_NOT_EXIST:Appkey not exist!

A non-existent Appkey was used.

Confirm whether a non-existent Appkey was used. You can log on to the console and view the project configuration to find the Appkey.

40020106

Meta:APPKEY_UID_MISMATCH:Appkey and user mismatch!

The Appkey and token passed in the call were not created by the same Alibaba Cloud account UID. This causes a mismatch.

Check whether you are using resources from two different accounts. Do not use an Appkey from Account A with a token generated from Account B.

403

Forbidden

The token is invalid. For example, the token does not exist or has expired.

Set a valid token. Tokens have an expiration period. You must obtain a new token before the current one expires.

41000003

MetaInfo doesn't have end point info

Failed to retrieve the routing information for this Appkey.

Check whether you are using resources from two different accounts. Do not use an Appkey from Account A with a token generated from Account B.

41010101

UNSUPPORTED_SAMPLE_RATE

The sample rate is not supported.

Real-time speech recognition currently supports only audio with a sample rate of 8000 Hz or 16000 Hz.

41040201

Realtime:GET_CLIENT_DATA_TIMEOUT:Client data does not send continuously!

Failed to retrieve data from the client due to a timeout.

When you call real-time speech recognition, the client must send data at a real-time rate and close the connection promptly after the data is sent.

50000000

GRPC_ERROR:Grpc error!

An exception caused by factors such as machine load or network issues. This error usually occurs randomly.

You can retry the call to resolve the issue.

50000001

GRPC_ERROR:Grpc error!

An exception caused by factors such as machine load or network issues. This error usually occurs randomly.

You can retry the call to resolve the issue.

52010001

GRPC_ERROR:Grpc error!

An exception caused by factors such as machine load or network issues. This error usually occurs randomly.

You can retry the call to resolve the issue.

Speech synthesis/Long-text speech synthesis error codes

Status code

Status message

Cause

Solution

40000001

Gateway:ACCESS_DENIED:No privilege to this voice!

An incorrect speaker name was set.

You can refer to the official documentation to set the correct speaker.

40000004

Gateway:IDLE_TIMEOUT:Websocket session is idle for too long time,the last directive is 'StartSynthesis'!

After a connection is established, the server returns this error message if no data is sent for more than 10 seconds.

Close the connection promptly after the request is processed. This error may also occur if the server is under high instantaneous pressure and cannot return data in time. In this case, you can retry the request to resolve the issue.

40010003

Gateway:DIRECTIVE_INVALID:No text specified!

No valid text for synthesis was set.

You can refer to the sample code in the official documentation to set the text for synthesis.

41020001

Speech synthesis client error

Multiple error messages may be returned. Adjust your code based on the specific error message.

  • If the message Engine return error code: 424. is returned, the background music or concatenated recording does not conform to the required format. You can set the correct background music as described in the documentation.

  • If the message Engine return error code:418 is returned, an unsupported speaker name was passed.

  • If the message Engine return error code: 413 is returned, the SSML format used is incorrect.

  • If the message Request json illegal,failed to parse request. is returned, the passed JSON format is invalid.

  • If the message SSML text length should be less than 300. is returned, the synthesis text is too long. You must use the long-text speech synthesis operation.

51020001

TTS:TtsServerError

An exception caused by factors such as machine load or network issues. This error usually occurs randomly.

You can retry the call to resolve the issue.

Speech synthesis/Offline speech synthesis

  • SDK-related

    Status code

    Status message

    Cause

    Solution

    140000

    TTS_CREATE_FAILED

    Engine initialization failed.

    The resource path is incorrect or a resource file is abnormal. This fault is often accompanied by the error code TTS_ASSETPATH_INVALID. Review the log to confirm. Ensure the provided resource path is valid and all resource files are complete.

    140001

    TTS_ENGINE_INVALID

    The engine is not initialized.

    The current TTS instance is not created. Check if the initialization API has been called.

    140002

    TTS_TEXT_ERROR

    The text is invalid, for example, empty.

    Check the SDK log to confirm that the file is invalid. Ensure that the input text is valid.

    140003

    TTS_MALLOC_FAILED

    Memory allocation failed.

    Out of memory. Ensure enough memory is available.

    140005

    TTS_ASSETPATH_INVALID

    The resource path is empty.

    The resource path is incorrect or a resource file is abnormal. Check the logs to confirm the fault. Ensure the provided resource path is valid and all resource files are complete.

    140006

    TTS_HANLDE_INVALID

    The processing thread does not exist.

    You can release TTS and then retry.

    140007

    TTS_CREATE_HANLDE_FAILED

    Failed to create the processing thread.

    Check the error message in the log to identify the problem.

    140008

    TTS_AUTH_FAILED

    Authentication failed. The SDK cannot be used.

    Check that the akId, akSecret, and appkey are correct. Review the error message in the log for details. The issue may be that offline authentication is not enabled or that your quota is exhausted.

    140011

    TTS_OPERATE_INVALID

    Invalid operation.

    The current processing thread is in an invalid state. This can occur if a call, such as `pause`, is made before initialization. Ensure that calls are valid for the current state.

    140012

    TTS_OPEN_FILE_FAILED

    Failed to open the file.

    Failed to open the wav debug file or the log file. Check the error message in the log for details.

    140013

    TTS_STATE_INVALID

    State machine verification failed.

    The method call is invalid for the current state machine. This can occur if a method, such as `pause`, is called before initialization. Ensure that method calls are valid for the current state.

    140014

    TTS_SYNTHESIZER_INIT_ERROR

    Synthesizer initialization failed.

    Synthesizer creation failed, mainly due to out of memory.

    140015

    TTS_SYNTHESIZER_RELEASE_ERROR

    Synthesizer release failed.

    The synthesizer failed to release. Check the logs to pinpoint the cause.

    140016

    TTS_SYNTHESIZER_FAILED

    Synthesis failed.

    A state fault occurred during pre-playback. Check the logs to pinpoint the cause.

    140017

    TTS_WAIT_TIMEOUT

    Timeout exit.

    If a timeout occurs while waiting for a status, check the logs for details.

    140018

    TTS_CLOSED

    The TTS part of the code was not compiled.

    The current SDK does not include the TTS feature. Switch to the correct SDK.

  • Parameter configuration-related

    Status code

    Status message

    Cause

    Solution

    140100

    TTS_PARAM_INVALID

    Invalid parameter.

    An invalid input parameter was provided during initialization or when setting parameters. For example, the workspace, callback, taskId, or text is empty. Check the logs to locate the specific error.

    140101

    TTS_PARAM_VALUE_INVALID

    Invalid parameter value.

    Invalid input parameter. Check the logs to pinpoint the error.

    140102

    TTS_CFG_OPEN_FAILED

    Failed to open the configuration file.

    The resource path is incorrect or the resource file is abnormal. Check the log to confirm. Ensure the resource path is valid and all resource files are complete.

  • Audio processing

    Status code

    Status message

    Cause

    Solution

    140200

    TTS_AM_CREATE_FAILED

    Player creation failed.

    Creation of the SDK's internal audio manager failed.

    140210

    TTS_AM_OPEN_FAILED

    Player open failed.

    The SDK internal audio manager failed to open. Check the logs to pinpoint the issue.

    140210

    TTS_DECODER_INIT_FAILED

    Audio decoder initialization failed.

    The audio decoder, possibly an MP3 decoder, failed to initialize. Check the logs to pinpoint the cause.

    140211

    TTS_DECODER_MALLOC_FAILED

    Audio decoder failed to allocate memory.

    Out of memory. Ensure enough memory is available.

    140212

    TTS_DECODER_INPUT_TOO_MANY

    Too much data was input at once and will be discarded.

    Check the log to identify the specific issue. The maximum data size for a single input is 2000.

    140213

    TTS_DECODER_OUTPUT_TOO_MANY

    Too much data was output, exceeding the cache, and will be lost.

    Check the logs for detailed information.

    140220

    TTS_AP_INIT_FAILED

    Audio processing unit (audioplayer) failed to open.

    This error is typically returned with other AP ErrorCodes. Check the logs for more details.

    140221

    TTS_AP_START_FAILED

    Error starting ap.

    Check the logs to pinpoint the issue.

    140222

    TTS_AP_MALLOC_FAILED

    Audioplayer failed to allocate memory.

    Out of memory. Ensure there is enough memory to run.

    140231

    TTS_BGM_DECODE_INVALID

    Decoder initialization failed.

    Check the logs to confirm if the decoder is initialized.

    140233

    TTS_BGM_MALLOC_FAILED

    Memory allocation failed.

    Out of memory. Ensure there is enough memory to run.

    140237

    TTS_BGM_PARAM_INVALID

    Background music parameter setting error.

    Confirm the parameter settings are correct. Check the log to find the problem. Look for the bgm value:.

  • Cache-related

    Status code

    Status message

    Cause

    Solution

    140300

    TTS_CACHE_INIT_FAILED

    Failed to initialize cache.

    This error is often accompanied by the TTS_CACHE_PATH_INVALID error code. This may indicate an invalid storage path. Check the logs for details.

    140302

    TTS_CACHE_CMD_ERROR

    The cache command is not standard.

    Check the returned error message and log to pinpoint the fault.

    140308

    TTS_CACHE_PATH_INVALID

    Failed to create the cache path.

    Check the returned error message and log to locate the fault.

    140309

    TTS_CACHE_LIST_CREATE_FAILED

    Failed to create the cache list.

    Check the returned fault message and log for details.

    140311

    TTS_CACHE_TOO_MANY

    Too much cache.

    View the logs for details.

    140312

    TTS_CACHE_PARAM_INVALID

    Parameter error.

    Check the returned error message and log for details.

    140313

    TTS_CACHE_RECORDING_OPEN_FAILED

    Error opening local file.

    The file permissions or path might be incorrect. Check the logs for details.

  • Font delivery-related

    Status code

    Status message

    Cause

    Solution

    140351

    TTS_FONT_INITLIST_FAILED

    Initialize the fontlist manager.

    Out of memory. Ensure there is enough memory to run.

    140352

    TTS_FONT_INITLIST_INVALID

    The fontlist manager is not initialized.

    Out of memory. Ensure sufficient memory is available to run.

    140353

    TTS_FONT_CMD_INVALID

    The command format is incorrect.

    Check the returned fault messages and logs to identify the issue.

    140354

    TTS_FONT_RESPONSE_ERROR

    The server returned an incorrect format.

    Check the returned error messages and logs to pinpoint the issue.

    140350

    TTS_FONT_RESPONSELIST_ERROR

    The fontlist request to the server returned an incorrect format.

    Check the returned error message and log to locate the fault.

    140356

    TTS_FONT_GET_FONTLIST_FAILED

    Failed to get the fontlist.

    Check the returned error messages and logs to pinpoint the error.

    140358

    TTS_FONT_LOCALMSG_ERROR

    Failed to parse the local list file.

    You can check the returned error messages and logs to pinpoint the problem.

    140359

    TTS_FONT_LOCALFILE_ERROR

    Failed to save the current list file.

    Check the returned error messages and logs to pinpoint the problem.

    140360

    TTS_FONT_CLOUDMSG_ERROR

    Failed to parse the cloud list.

    Check the returned error messages and logs to locate the problem.

  • Local engine-related

    Status code

    Status message

    Cause

    Solution

    140900

    TTS_LOCAL_CRE_ENGINE_ERROR

    Local engine initialization failed.

    An internal error occurred in the local DPI engine. Check other error messages in the log to diagnose the fault.

    140901

    TTS_LOCAL_ENGINE_INVALID

    The local engine is not initialized.

    Check if TTS is initialized. Review the returned error messages and logs for details.

    140902

    TTS_LOCAL_ASSET_ERROR

    Local resource verification failed.

    The local engine failed to validate the resource path. Check the log for details.

    140903

    TTS_LOCAL_CRE_TASK_ERROR

    Failed to create a local task.

    You can check the logs to locate the specific issue.

    140905

    TTS_LOCAL_START_FAILED

    Failed to start local synthesis.

    View the logs to pinpoint the issue.

    140906

    TTS_LOCAL_OPERATION_FAILED

    Local operation failed, for example, the local task does not exist or there is a default error.

    View the logs to pinpoint details.

    140907

    TTS_LOCAL_SWITCH_FONT_FAILED

    Failed to switch speaker.

    Review the logs for details.

    140908

    TTS_LOCAL_GET_SAMPLERATE_FAILED

    Failed to get the speaker's sample rate.

    Check the logs to pinpoint the issue.

    140909

    TTS_LOCAL_ADD_FRONT_END_FAILED

    Failed to add speaker.

    Check the logs for details.

    140910

    TTS_LOCAL_VOICE_PATH_INVALID

    The local speaker file does not exist or file authentication failed.

    Check the logs to pinpoint the cause.

    140911

    TTS_LOCAL_VOICE_MISMATCH

    Local speaker file mismatch.

    Check the logs for details.

  • Cloud engine-related

    Status code

    Status message

    Cause

    Solution

    141000

    TTS_CLOUD_CREATE_FAILED

    Cloud engine initialization failed.

    View the logs for detailed information.

    141004

    TTS_CLOUD_START_FAILED

    Cloud request failed.

    This issue is typically caused by a network connection failure or invalid parameters for the Appkey, Token, or URL. Check the logs to pinpoint the exact cause.

    141007

    TTS_CLOUD_NETWORK_BROKEN

    The network is poor.

    If the network connection is poor, switch to a different network environment and try again.

    141008

    TTS_CLOUD_SSL_CONNECT_FAILED

    SSL connection failed. Check whether the sent parameters are correct.

    SSL connection failed. Check the send parameters. Review the logs for details.

    141009

    TTS_CLOUD_HTTP_CONNECT_FAILED

    HTTP connection failed. Check whether the sent parameters are correct.

    HTTP connection failed. Check the sent parameters. Review the logs for details.

    141010

    TTS_CLOUD_DNS_FAILED

    Connection failed, DNS failed.

    Connection failed. DNS failed. Check that the domain name resolution is correct. For more details, see the logs.

    141011

    TTS_CLOUD_URL_INVALID

    The URL is invalid.

    The URL is invalid. Ping the URL and port to confirm they are reachable. Check the logs for details to locate the issue.

    141012

    TTS_CLOUD_PROTOCOL_ERROR

    Cloud protocol error.

    Cloud protocol error. Check the logs for details.

    141013

    TTS_CLOUD_PARAMETERS_ERROR

    Parameter error.

    Cloud parameter error. Check the log for details.

    141014

    TTS_CLOUD_UNKNOWN_WS_HEAD_TYPE

    WebSocket uses an unknown header type.

    This is a known issue with older clients. Upgrade to the latest version.

  • Server-side status codes

    Status code

    Status message

    Cause

    Solution

    144001

    TTS_CLOUD_AUTH_FAILED

    Identity authentication failed.

    Check whether the token used is correct and whether it has expired.

    144002

    TTS_CLOUD_INVALID_MESSAGE

    Invalid message.

    Check whether the sent message meets the requirements.

    144003

    TTS_CLOUD_INVALID_TOKEN

    The token has expired or the parameter is invalid.

    First, check whether the token used has expired. Then, check whether the parameter value is set reasonably.

    144004

    TTS_CLOUD_WAIT_TIMEOUT

    Idle timeout.

    Confirm whether data has not been sent to the server for a long time (more than 10 seconds).

    144005

    TTS_CLOUD_EXCEED_CONCURRENCY

    Too many requests.

    Check whether the number of concurrent connections or requests per second has been exceeded. If the concurrency limit is exceeded, upgrade from the Free Edition to the commercial version, or scale out the concurrency resources for the commercial version.

    144006

    TTS_CLOUD_DEFAULT_ERROR

    Uncategorized error returned by the cloud.

    For example, an invalid model ID was used. Check the log for details.

    144100

    TTS_CLOUD_INVALID_INTERFACE

    The interface is not supported.

    An unsupported operation was used.

    144101

    TTS_CLOUD_UNSUPPORTED_ORDER

    Unsupported instruction.

    An unsupported instruction was used.

    144102

    TTS_CLOUD_INVALID_ORDER

    Invalid instruction.

    The instruction format is incorrect.

    144103

    TTS_CLOUD_CLIENT_DISCONNECT

    The client disconnected prematurely.

    Check whether the connection was closed before the request was completed normally.

    144200

    TTS_CLOUD_INVALID_APPKEY

    The application does not exist.

    Check whether the application AppKey is correct and whether it belongs to the same account as the Token.

    144300

    TTS_CLOUD_INVALID_PARAM

    Parameter error.

    Check whether the correct parameters were passed.

    144301

    TTS_CLOUD_UNSENDAUDIO

    The client did not send a command for 10 seconds.

    Check for network issues, or check whether there are situations in your business where no data is sent.

    144302

    TTS_CLOUD_SENDAUDIO_TOO_FAST

    The client is sending data too fast, and server resources are exhausted.

    Check whether the client is sending packets too fast and whether they are sent at a 1:1 real-time rate.

    144303

    TTS_CLOUD_INVALID_AUDIO_FORMAT

    The audio format sent by the client is incorrect.

    Convert the audio data format to a format currently supported by the SDK.

    144304

    TTS_CLOUD_INVALID_INVOKE

    The client method call is abnormal.

    The client should call the send request operation first, and then call other operations after the request is sent.

    144305

    TTS_CLOUD_INVALID_MAX_SILENCE

    The client's MAXSILENCE_PARAM method setting is abnormal.

    The range of the MAXSILENCE_PARAM parameter is 200 to 2000.

    144306

    TTS_CLOUD_MISMATCHED_SAMPLERATE

    The sample rate does not match.

    Check whether the sample rate set during the call is consistent with the sample rate of the ASR model bound to the Appkey on the management console.

    144400

    TTS_CLOUD_SERVER_ERROR

    TTS server error.

    This can be ignored if it occurs randomly.

    144401

    TTS_CLOUD_INTERNAL_SERVER_ERROR

    Server internal error.

    Unknown error.

    144402

    TTS_CLOUD_SPEECH_TRANSCRIBER_SERVER_ERROR

    The real-time speech recognition service is unavailable.

    Check whether the real-time speech recognition service has a task backlog that is causing task submission to fail.

    144403

    TTS_CLOUD_SPEECH_TRANSCRIBER_REQUEST_TIMEOUT

    The request to the real-time speech recognition service timed out.

    Check the real-time speech recognition logs.

    144404

    TTS_CLOUD_INVOKE_SPEECH_TRANSCRIBER_FAILED

    Failed to call the real-time speech recognition service.

    Check whether the real-time speech recognition service is started and whether the port is open normally.

    144405

    TTS_CLOUD_SPEECH_TRANSCRIBER_BALANCE_FAILED

    Real-time speech recognition service load balancing failed. Failed to get the IP address of the real-time speech recognition service.

    Check for exceptions with the real-time speech recognition service machine in the VPC.

    144406

    TTS_CLOUD_SERVER_AGAIN

    Internal call error.

    Internal service error. The client needs to retry.