语音交互服务 SIS-语音合成(http版):请求参数

时间:2024-07-03 11:01:46

请求参数

  1. 请求类为RunTtsRequest,其中包含参数类PostCustom TTS Req,该类包含两个参数text(待合成文本)和TtsConfig,详见TtsConfig。
    表1 TtsConfig

    参数名称

    是否必选

    参数类型

    描述

    audio_format

    String

    待合成的音频格式,可选mp3,wav等,默认wav。具体信息请参见《API参考》中 语音合成 章节。

    pitch

    Integer

    音高,[-500,500] ,默认是0。

    speed

    Integer

    语速,[-500,500] ,默认是0。

    volume

    Integer

    音量,[0,100],默认是50。

    sample_rate

    String

    采样率,支持“8000”、“16000”,默认“8000”。

    property

    String

    特征字符串,{language}_{speaker}_{domain},默认chinese_xiaoqi_common。具体信息请参见《API参考》中语音合成章节。

  2. 伪代码
    TtsConfig configbody = new TtsConfig();
    configbody.setAudioFormat(TtsConfig.AudioFormatEnum.fromValue("wav"));
    configbody.setSampleRate(TtsConfig.SampleRateEnum.fromValue("8000"));
    configbody.setProperty(TtsConfig.PropertyEnum.fromValue("chinese_huaxiaomei_common"));
    RunTtsRequest request = new RunTtsRequest();
    PostCustomTTSReq body = new PostCustomTTSReq();
    body.withConfig(configbody);
    if (!StringUtils.isEmpty(text.getText().toString())) {
    	body.withText(text.getText().toString());
    } else {
    	body.withText("请输入合成文本");
    }
    request.withBody(body);
    return request;
support.huaweicloud.com/sdkreference-sis/sis_05_0088.html