Skip to content

Commit

Permalink
com.rest.elevenlabs 3.2.1 (#53)
Browse files Browse the repository at this point in the history
- Fixed text to speech encoding specification
  • Loading branch information
StephenHodgson committed Dec 15, 2023
1 parent 19515c4 commit 0f75a68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,27 @@ namespace ElevenLabs.TextToSpeech
[Preserve]
internal sealed class TextToSpeechRequest
{
[Preserve]
[JsonConstructor]
public TextToSpeechRequest(
[JsonProperty("text")] string text,
[JsonProperty("model_id")] Model model,
[JsonProperty("voice_settings")] VoiceSettings voiceSettings)
[JsonProperty("model_id")] Model model = null,
[JsonProperty("voice_settings")] VoiceSettings voiceSettings = null)
: this(text, model, voiceSettings, Encoding.UTF8)
{
}

[Preserve]
public TextToSpeechRequest(string text, Model model = null, VoiceSettings voiceSettings = null, Encoding encoding = null)
{
if (string.IsNullOrWhiteSpace(text))
{
throw new ArgumentNullException(nameof(text));
}

if (!Encoding.GetEncoding(text).Equals(Encoding.UTF8))
if (encoding?.Equals(Encoding.UTF8) == false)
{
text = Encoding.UTF8.GetString(Encoding.Default.GetBytes(text));
text = Encoding.UTF8.GetString(encoding.GetBytes(text));
}

Text = text;
Expand Down
2 changes: 1 addition & 1 deletion ElevenLabs/Packages/com.rest.elevenlabs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "ElevenLabs",
"description": "A non-official Eleven Labs voice synthesis RESTful client.",
"keywords": [],
"version": "3.2.0",
"version": "3.2.1",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.rest.elevenlabs#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.rest.elevenlabs/releases",
Expand Down

0 comments on commit 0f75a68

Please sign in to comment.