Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Cognitive Engagement Center/ API Reference/ Chatbot Management Interface Reference/ Interface for Generating TTS Voices Based on Texts

Interface for Generating TTS Voices Based on Texts

Updated on 2023-09-27 GMT+08:00

Description

This interface, provide by the OIAP, is invoked by third-party systems to generate TTS voices.

If the text to be converted is long, the interface response time increases accordingly.

Interface Method

POST

URI

https://IP:PORT/oifde/rest/api/tts/texttovoice

Message Header

Content-Type:application/json; charset=UTF-8

Request

Table 1 Parameters in the request body

No.

Parameter

Type

Mandatory

Description

1

tenantId

String

Yes

Tenant ID.

2

authToken

String

Yes

Authentication token.

For details, see C3 OIAP Interface Authentication.

3

text

String

Yes

Text to be synthesized, which must be encoded using UTF-8.

4

config

Object

Yes

TTS configuration information.

For details about the parameters of this object, see Table 2.

Table 2 config

No.

Parameter

Type

Mandatory

Description

4.1

voiceName

String

Yes

Model feature string, which is used by the server to invoke different models.

The options are as follows:

  • cn_chengshuxing_common: mature
  • cn_kefuman_common: graceful
  • cn_roumeiqian_common: soft
  • cn_tianmeiru_common: sweet
  • cn_ziranzhen_common: natural

4.2

pitch

String

No

Fundamental frequency, which is used to adjust the pitch.

The value ranges from –500 to 500. The default value is 0.

4.3

volume

String

No

Volume, which is used to adjust the volume.

The value ranges from 0 to 100. The default value is 50.

4.4

speed

String

No

Speed, which is used to adjust the speech speed.

The value ranges from –500 to 500. The default value is 0.

Response

  • Status code: 200
    Table 3 Parameters in the response body

    No.

    Parameter

    Type

    Description

    1

    retCode

    String

    Result code. The value 0 indicates success and other values indicates failure.

    2

    retMsg

    String

    Description of a failure cause.

    3

    data

    Object

    Return result.

    For details about the parameters of this object, see Table 4.

    Table 4 data

    No.

    Parameter

    Type

    Description

    3.1

    format

    String

    Audio encoding format.

    3.2

    sampleRate

    Integer

    Audio sampling rate.

    3.3

    voiceData

    String

    Base64-encoded voice data.

    3.4

    sentences

    List

    Output sentence information.

    For details about the parameters of this object, see Table 5.

    Table 5 sentences

    No.

    Parameter

    Type

    Description

    3.4.1

    st

    Integer

    Start timestamp of a sentence, in milliseconds.

    3.4.2

    et

    Integer

    End timestamp of a sentence, in milliseconds.

    3.4.3

    offset

    Integer

    Start position of a sentence in the original text, in bytes.

    3.4.4

    len

    Integer

    Length of a sentence in the original text, in bytes.

  • Status code: 400

    Incorrect request. Check the request path and parameters.

  • Status code: 401

    Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact customer service to check the status of your account.

  • Status code: 404

    The requested content is not found. Check the request path.

  • Status code: 500

    Business failure. Check the values of parameters in the request.

Error code.

None

Example

Request header

Content-Type:application/json; charset=UTF-8

Request body message

{
    "config": {
       "voiceName":"cn_tianmeiru_common"		
    },
    "text":"Hello, test the TTS interface.",
    "authToken": "********************",
    "tenantId":"********************"
}

Response body message

{
  "data": {
    "sentences": [
      {
        "st": 0,
        "offset": 0,
        "len": 48,
        "et": 2790
      }
    ],
    "voiceData": "UklGRuRsAQBXQVZFZm10IBA",
    "format": "wav",
    "sampleRate": "16000"
  },
  "retCode": "0"
}

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback