static Future textToAudio(String text) async {
String ulr = Uri.encodeComponent(text); // To encode url
ulr = Uri.encodeComponent(ulr);
Dio dio = new Dio();
FormData formData = FormData.fromMap({
"tex": ulr,
"tok": InitNet.accessToken,
"cuid": "355697073811204",
"ctp": 1,
"lan": "zh",
"spd": 5,
"pit": 5,
"vol": 5,
"per": 0,
"aue": 6
});
String url = "https://tsn.baidu.com/text2audio?";
Response response = await dio.post(url, data: formData);
String result = response.data.toString();
}
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
你好,请问现在是有什么问题吗?如有参数不明确,可以查看文档并测试官方 demo https://github.com/Baidu-AIP/speech-demo/tree/master/rest-api-tts