Skip to content

Commit

Permalink
com.rest.elevenlabs 3.2.3 (#58)
Browse files Browse the repository at this point in the history
- updated com.utilities.rest -> 2.5.0
- updated com.utilities.encoder.ogg 3.1.2
- updated editor version to 2022.3.16f1 LTS
  • Loading branch information
StephenHodgson committed Jan 26, 2024
1 parent d4b3156 commit b4b35eb
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 20 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/upm-subtree-split.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ on:
push:
branches:
- main

jobs:
upm-subtree-split:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: upm subtree split
run: |
$packageDir = Get-Item -Path "**/Packages/com.*" | Select-Object -ExpandProperty FullName
$packageDir = $packageDir.replace('${{ github.workspace }}/','')
Write-Host $packageDir
git subtree split --prefix="$packageDir" -b upm
git push -u origin upm --force
working-directory: ${{ github.workspace }}
shell: pwsh

- uses: RageAgainstThePixel/upm-subtree-split@v1
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ private static GUIStyle BoldCenteredHeaderStyle

#endregion Static Content

[SerializeField]
private ElevenLabsConfiguration configuration;

[SerializeField]
private int tab;

Expand All @@ -518,6 +521,10 @@ private static GUIStyle BoldCenteredHeaderStyle
[SerializeField]
private List<AudioClip> newSampleClips;

private ElevenLabsAuthentication auth;

private ElevenLabsSettings settings;

private Vector2 scrollPosition = Vector2.zero;

private string speechSynthesisTextInput = string.Empty;
Expand All @@ -543,6 +550,17 @@ private void OnFocus()
audioPlayButtonContent ??= EditorGUIUtility.IconContent("d_PlayButton");
audioStopButtonContent ??= EditorGUIUtility.IconContent("d_PauseButton");

if (configuration == null)
{
configuration = Resources.Load<ElevenLabsConfiguration>($"{nameof(configuration)}.asset");
}

auth ??= configuration == null
? new ElevenLabsAuthentication().LoadDefaultsReversed()
: new ElevenLabsAuthentication(configuration);
settings ??= configuration == null
? new ElevenLabsSettings()
: new ElevenLabsSettings(configuration);
api ??= new ElevenLabsClient();

if (!hasFetchedUserInfo ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public async Task<VoiceClip> DownloadHistoryAudioAsync(HistoryItem historyItem,
}

await Awaiters.UnityMainThread;
var audioClip = await Rest.DownloadAudioClipAsync($"file://{cachedPath}", AudioType.UNKNOWN, debug: EnableDebug, cancellationToken: cancellationToken);
var audioClip = await Rest.DownloadAudioClipAsync($"file://{cachedPath}", AudioType.UNKNOWN, parameters: new RestParameters(debug: EnableDebug), cancellationToken: cancellationToken);
return new VoiceClip(historyItem.Id, historyItem.Text, voice, audioClip, cachedPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public async Task<VoiceClip> TextToSpeechAsync(TextToSpeechRequest request, Canc
}

await Awaiters.UnityMainThread;
var audioClip = await Rest.DownloadAudioClipAsync($"file://{cachedPath}", audioType, debug: EnableDebug, cancellationToken: cancellationToken);
var audioClip = await Rest.DownloadAudioClipAsync($"file://{cachedPath}", audioType, parameters: new RestParameters(debug: EnableDebug), cancellationToken: cancellationToken);
return new VoiceClip(clipId, request.Text, request.Voice, audioClip, cachedPath);
}

Expand Down Expand Up @@ -228,7 +228,7 @@ public async Task<VoiceClip> StreamTextToSpeechAsync(TextToSpeechRequest request
var cachedPath = $"{downloadDirectory}/{clipId}.ogg";
await File.WriteAllBytesAsync(cachedPath, oggBytes, cancellationToken: cancellationToken).ConfigureAwait(false);
await Awaiters.UnityMainThread;
await Rest.DownloadAudioClipAsync($"file://{cachedPath}", AudioType.OGGVORBIS, debug: EnableDebug, cancellationToken: cancellationToken);
await Rest.DownloadAudioClipAsync($"file://{cachedPath}", AudioType.OGGVORBIS, parameters: new RestParameters(debug: EnableDebug), cancellationToken: cancellationToken);
return new VoiceClip(clipId, request.Text, request.Voice, fullClip, cachedPath);

void StreamCallback(Response partialResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async Task<GeneratedVoiceOptions> GetVoiceGenerationOptionsAsync(Cancella
}

await File.WriteAllBytesAsync(cachedPath, response.Data, cancellationToken).ConfigureAwait(true);
var audioClip = await Rest.DownloadAudioClipAsync($"file://{cachedPath}", AudioType.MPEG, debug: EnableDebug, cancellationToken: cancellationToken);
var audioClip = await Rest.DownloadAudioClipAsync($"file://{cachedPath}", AudioType.MPEG, parameters: new RestParameters(debug: EnableDebug), cancellationToken: cancellationToken);
return new Tuple<string, AudioClip>(generatedVoiceId, audioClip);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public async Task<VoiceClip> DownloadVoiceSampleAudioAsync(Voice voice, Sample s
}
}

var audioClip = await Rest.DownloadAudioClipAsync($"file://{cachedPath}", audioType, debug: EnableDebug, cancellationToken: cancellationToken);
var audioClip = await Rest.DownloadAudioClipAsync($"file://{cachedPath}", audioType, parameters: new RestParameters(debug: EnableDebug), cancellationToken: cancellationToken);
return new VoiceClip(sample.Id, string.Empty, voice, audioClip, cachedPath);
}

Expand Down
6 changes: 3 additions & 3 deletions 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.2",
"version": "3.2.3",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.rest.elevenlabs#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.rest.elevenlabs/releases",
Expand All @@ -17,8 +17,8 @@
"url": "https://github.com/StephenHodgson"
},
"dependencies": {
"com.utilities.rest": "2.4.0",
"com.utilities.encoder.ogg": "3.1.1"
"com.utilities.rest": "2.5.0",
"com.utilities.encoder.ogg": "3.1.2"
},
"samples": [
{
Expand Down
2 changes: 1 addition & 1 deletion ElevenLabs/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"com.unity.ide.rider": "3.0.27",
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.test-framework": "1.3.5",
"com.utilities.buildpipeline": "1.1.9"
"com.utilities.buildpipeline": "1.2.1"
},
"scopedRegistries": [
{
Expand Down
4 changes: 2 additions & 2 deletions ElevenLabs/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2022.3.15f1
m_EditorVersionWithRevision: 2022.3.15f1 (b58023a2b463)
m_EditorVersion: 2022.3.16f1
m_EditorVersionWithRevision: 2022.3.16f1 (d2c21f0ef2f1)

0 comments on commit b4b35eb

Please sign in to comment.