TTS 返回语音优化
This commit is contained in:
@@ -53,7 +53,7 @@ public class ElevenLabsClient {
|
|||||||
Map<String, Object> payload = new HashMap<>();
|
Map<String, Object> payload = new HashMap<>();
|
||||||
payload.put("text", text);
|
payload.put("text", text);
|
||||||
payload.put("model_id", modelId);
|
payload.put("model_id", modelId);
|
||||||
payload.put("voice_settings", new VoiceSettings(0.8, 0.5,1,0));
|
payload.put("voice_settings", new VoiceSettings(0.85, 0.5,1,0,0.9));
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
StringEntity entity = new StringEntity(gson.toJson(payload), ContentType.APPLICATION_JSON);
|
StringEntity entity = new StringEntity(gson.toJson(payload), ContentType.APPLICATION_JSON);
|
||||||
httpPost.setEntity(entity);
|
httpPost.setEntity(entity);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class VoiceSettings {
|
|||||||
/**
|
/**
|
||||||
* 设置语速
|
* 设置语速
|
||||||
*/
|
*/
|
||||||
private double speed;
|
private double rate;
|
||||||
// 可选:其他语音配置(如稳定性stability、相似度boost,默认无需设置)
|
// 可选:其他语音配置(如稳定性stability、相似度boost,默认无需设置)
|
||||||
private double stability;
|
private double stability;
|
||||||
|
|
||||||
@@ -16,11 +16,14 @@ public class VoiceSettings {
|
|||||||
|
|
||||||
private double start_time;
|
private double start_time;
|
||||||
|
|
||||||
public VoiceSettings(double stability, double similarity_boost, double speed,double start_time) {
|
private double clarity;
|
||||||
|
|
||||||
|
public VoiceSettings(double stability, double similarity_boost, double rate,double start_time,double clarity) {
|
||||||
this.stability = stability;
|
this.stability = stability;
|
||||||
this.similarity_boost = similarity_boost;
|
this.similarity_boost = similarity_boost;
|
||||||
this.speed = speed;
|
this.rate = rate;
|
||||||
this.start_time = start_time;
|
this.start_time = start_time;
|
||||||
|
this.clarity = clarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getter方法
|
// getter方法
|
||||||
@@ -32,6 +35,14 @@ public class VoiceSettings {
|
|||||||
return similarity_boost;
|
return similarity_boost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getSpeed() { return speed; }
|
public double getRate() { return rate; }
|
||||||
|
|
||||||
|
|
||||||
|
public double getStart_time() {
|
||||||
|
return start_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getClarity() {
|
||||||
|
return clarity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user