Skip to content

Commit 8539aa2

Browse files
com.rest.elevenlabs 2.0.5 (#25)
- updated voice settings - added speaker boost and style options
1 parent 3b94244 commit 8539aa2

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

Editor/ElevenLabsEditorWindow.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,10 @@ private static GUIStyle BoldCenteredHeaderStyle
497497
private string currentModelId;
498498

499499
[SerializeField]
500-
private Vector2 voiceSettingsSliderValues = Vector2.zero;
500+
private Vector3 voiceSettingsSliderValues = Vector3.zero;
501+
502+
[SerializeField]
503+
private bool useSpeakerBoost = true;
501504

502505
[SerializeField]
503506
private List<AudioClip> newSampleClips;
@@ -823,7 +826,7 @@ private void RenderSpeechSynthesis()
823826
}
824827

825828
if (currentVoiceSettings == null ||
826-
voiceSettingsSliderValues == Vector2.zero)
829+
voiceSettingsSliderValues == Vector3.zero)
827830
{
828831
GetDefaultVoiceSettings(currentVoiceOption);
829832
}
@@ -871,6 +874,21 @@ private void RenderSpeechSynthesis()
871874
EndIndent(InnerLabelIndentLevel);
872875
}
873876
EditorGUILayout.EndHorizontal();
877+
EditorGUILayout.Space(EndWidth);
878+
voiceSettingsSliderValues.z = EditorGUILayout.Slider("Style", voiceSettingsSliderValues.z, 0f, 1f);
879+
EditorGUILayout.BeginHorizontal();
880+
{
881+
StartIndent(InnerLabelIndentLevel);
882+
EditorGUIUtility.labelWidth = WideColumnWidth * InnerLabelWidth;
883+
EditorGUILayout.LabelField("Low", expandWidthOption);
884+
GUILayout.FlexibleSpace();
885+
EditorGUILayout.LabelField("High", RightMiddleAlignedLabel, expandWidthOption);
886+
EditorGUIUtility.labelWidth = WideColumnWidth * SettingsLabelWidth;
887+
EndIndent(InnerLabelIndentLevel);
888+
}
889+
EditorGUILayout.EndHorizontal();
890+
EditorGUILayout.Space(EndWidth);
891+
useSpeakerBoost = EditorGUILayout.Toggle("Speaker Boost", useSpeakerBoost);
874892
EditorGUILayout.Space();
875893
}
876894

@@ -921,7 +939,7 @@ private void RenderSpeechSynthesis()
921939

922940
if (EditorGUI.EndChangeCheck())
923941
{
924-
currentVoiceSettings = new VoiceSettings(voiceSettingsSliderValues.x, voiceSettingsSliderValues.y);
942+
currentVoiceSettings = new VoiceSettings(voiceSettingsSliderValues.x, voiceSettingsSliderValues.y, useSpeakerBoost, voiceSettingsSliderValues.z);
925943
}
926944

927945
EditorGUILayout.EndHorizontal();
@@ -1052,7 +1070,8 @@ private async void GetDefaultVoiceSettings(Voice voice)
10521070
var defaultVoiceSettings = await api.VoicesEndpoint.GetDefaultVoiceSettingsAsync();
10531071
await api.VoicesEndpoint.EditVoiceSettingsAsync(voice, defaultVoiceSettings);
10541072
currentVoiceSettings = await api.VoicesEndpoint.GetVoiceSettingsAsync(voice);
1055-
voiceSettingsSliderValues = new Vector2(defaultVoiceSettings.Stability, defaultVoiceSettings.SimilarityBoost);
1073+
voiceSettingsSliderValues = new Vector3(defaultVoiceSettings.Stability, defaultVoiceSettings.SimilarityBoost, 0.45f);
1074+
useSpeakerBoost = true;
10561075
}
10571076
catch (Exception e)
10581077
{

Runtime/Voices/VoiceSettings.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ public sealed class VoiceSettings
1515
[JsonConstructor]
1616
public VoiceSettings(
1717
[JsonProperty("stability")] float stability,
18-
[JsonProperty("similarity_boost")] float similarityBoost)
18+
[JsonProperty("similarity_boost")] float similarityBoost,
19+
[JsonProperty("speaker_boost")] bool speakerBoost = true,
20+
[JsonProperty("style")] float style = 0.45f)
1921
{
2022
Stability = stability;
2123
SimilarityBoost = similarityBoost;
24+
SpeakerBoost = speakerBoost;
25+
Style = style;
2226
}
2327

2428
[Range(0f, 1f)]
@@ -44,5 +48,28 @@ public float SimilarityBoost
4448
get => similarityBoost;
4549
private set => similarityBoost = value;
4650
}
51+
52+
[Range(0f, 1f)]
53+
[SerializeField]
54+
private float style = 0.45f;
55+
56+
[Preserve]
57+
[JsonProperty("style")]
58+
public float Style
59+
{
60+
get => style;
61+
set => style = value;
62+
}
63+
64+
[SerializeField]
65+
private bool speakerBoost = true;
66+
67+
[Preserve]
68+
[JsonProperty("use_speaker_boost")]
69+
public bool SpeakerBoost
70+
{
71+
get => speakerBoost;
72+
set => speakerBoost = value;
73+
}
4774
}
4875
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "ElevenLabs",
44
"description": "A non-official Eleven Labs voice synthesis RESTful client.",
55
"keywords": [],
6-
"version": "2.0.4",
6+
"version": "2.0.5",
77
"unity": "2021.3",
88
"documentationUrl": "https://github.com/RageAgainstThePixel/com.rest.elevenlabs#documentation",
99
"changelogUrl": "https://github.com/RageAgainstThePixel/com.rest.elevenlabs/releases",

0 commit comments

Comments
 (0)