1 Commits
v63 ... v64

Author SHA1 Message Date
Andrew Stein
5288fde44e Fixed bug in speech to speech code. 2023-11-16 17:44:39 -05:00
3 changed files with 19 additions and 3 deletions

View File

@@ -60,7 +60,7 @@
<groupId>net.andrewcpu</groupId>
<artifactId>elevenlabs-api</artifactId>
<version>2.7.4-SNAPSHOT</version>
<version>2.7.5-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>

View File

@@ -1,5 +1,7 @@
package net.andrewcpu.elevenlabs.requests.sts;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.andrewcpu.elevenlabs.enums.StreamLatencyOptimization;
import net.andrewcpu.elevenlabs.model.voice.VoiceSettings;
import net.andrewcpu.elevenlabs.requests.PostRequest;
@@ -31,9 +33,15 @@ public class PostSpeechToSpeechRequest extends PostRequest<File> {
@Override
public Object getPayload() {
Map<String, Object> body = new HashMap<>();
String voiceSettingsString;
try {
voiceSettingsString = new ObjectMapper().writeValueAsString(voiceSettings);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
body.put("audio", audio);
body.put("model_id", modelId);
body.put("voice_settings", voiceSettings);
body.put("voice_settings", voiceSettingsString);
return body;
}
}

View File

@@ -1,5 +1,7 @@
package net.andrewcpu.elevenlabs.requests.sts;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.andrewcpu.elevenlabs.enums.StreamLatencyOptimization;
import net.andrewcpu.elevenlabs.model.voice.VoiceSettings;
import net.andrewcpu.elevenlabs.requests.PostRequest;
@@ -32,9 +34,15 @@ public class PostSpeechToSpeechStreamedRequest extends PostRequest<InputStream>
@Override
public Object getPayload() {
Map<String, Object> body = new HashMap<>();
String voiceSettingsString;
try {
voiceSettingsString = new ObjectMapper().writeValueAsString(voiceSettings);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
body.put("audio", audio);
body.put("model_id", modelId);
body.put("voice_settings", voiceSettings);
body.put("voice_settings", voiceSettingsString);
return body;
}
}