diff --git a/vetti-common/src/main/java/com/vetti/common/ai/elevenLabs/ElevenLabsClient.java b/vetti-common/src/main/java/com/vetti/common/ai/elevenLabs/ElevenLabsClient.java index 464890a..0ca9324 100644 --- a/vetti-common/src/main/java/com/vetti/common/ai/elevenLabs/ElevenLabsClient.java +++ b/vetti-common/src/main/java/com/vetti/common/ai/elevenLabs/ElevenLabsClient.java @@ -53,7 +53,7 @@ public class ElevenLabsClient { Map payload = new HashMap<>(); payload.put("text", text); payload.put("model_id", modelId); - payload.put("voice_settings", new VoiceSettings(0.8, 0.5,1)); + payload.put("voice_settings", new VoiceSettings(0.8, 0.5,1,0)); Gson gson = new Gson(); StringEntity entity = new StringEntity(gson.toJson(payload), ContentType.APPLICATION_JSON); httpPost.setEntity(entity); @@ -102,14 +102,15 @@ public class ElevenLabsClient { public String handleTextToVoice(String inputText,String outputFile){ CloseableHttpClient httpClient = HttpClients.createDefault(); try { - // 获取可用语音 - VoicesResponse voicesResponse = getVoices(httpClient); - if (voicesResponse != null && voicesResponse.getVoices() != null - && voicesResponse.getVoices().length > 0) { - // 使用第一个可用语音进行文本转语音(澳洲本地女声) - String firstVoiceId = "21m00Tcm4TlvDq8ikWAM"; - textToSpeech(inputText, firstVoiceId, outputFile,httpClient); - } +// // 获取可用语音 +// VoicesResponse voicesResponse = getVoices(httpClient); +// if (voicesResponse != null && voicesResponse.getVoices() != null +// && voicesResponse.getVoices().length > 0) { +// +// } + // 使用第一个可用语音进行文本转语音(澳洲本地女声) + String firstVoiceId = "21m00Tcm4TlvDq8ikWAM"; + textToSpeech(inputText, firstVoiceId, outputFile,httpClient); } catch (IOException e) { e.printStackTrace(); } finally { diff --git a/vetti-common/src/main/java/com/vetti/common/ai/elevenLabs/vo/VoiceSettings.java b/vetti-common/src/main/java/com/vetti/common/ai/elevenLabs/vo/VoiceSettings.java index d33c698..6a7c503 100644 --- a/vetti-common/src/main/java/com/vetti/common/ai/elevenLabs/vo/VoiceSettings.java +++ b/vetti-common/src/main/java/com/vetti/common/ai/elevenLabs/vo/VoiceSettings.java @@ -14,10 +14,13 @@ public class VoiceSettings { private double similarity_boost; - public VoiceSettings(double stability, double similarity_boost, double speed) { + private double start_time; + + public VoiceSettings(double stability, double similarity_boost, double speed,double start_time) { this.stability = stability; this.similarity_boost = similarity_boost; this.speed = speed; + this.start_time = start_time; } // getter方法