Files
fys-Multi-tenant/fys-admin/src/main/java/com/fuyuanshen/app/http/HttpTtsExample.java

33 lines
1021 B
Java
Raw Normal View History

2026-02-02 16:06:11 +08:00
package com.fuyuanshen.app.http;
import java.io.IOException;
public class HttpTtsExample {
/**
* appKey: lbGuq5K5bEH4uxmT
* akId: LTAI5t66moCkhNC32TDJ5ReP
* akSecret: 2F3sdoBJ08bYvJcuDgSkLnJwGXsvYH
* @param args
*/
public static void main(String[] args) {
String accessKeyId = "LTAI5t66moCkhNC32TDJ5ReP";
String accessKeySecret = "2F3sdoBJ08bYvJcuDgSkLnJwGXsvYH";
String appKey = "lbGuq5K5bEH4uxmT";
try {
// 使用HTTP方式调用
HttpTtsClient httpClient = new HttpTtsClient(accessKeyId, accessKeySecret, appKey);
2026-02-06 11:50:38 +08:00
String text = "前方拥堵,请绕道而行。";
String outputPath = "D:\\http_output11.mp3";
2026-02-02 16:06:11 +08:00
String resultFile = httpClient.saveMp3ToFile(text, outputPath);
System.out.println("MP3音频已保存至: " + resultFile);
} catch (IOException e) {
e.printStackTrace();
}
}
}