generated from RageAgainstThePixel/upm-template
-
-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Report
The issue applies to the Android build. PC is working fine. I didn't try iOS.
Overview
After the change of the SampleCallback in StreamingAudioSource from BufferCallback() to SampleCallackAsync(), there is a serious crash that closes the app on Android. It happens on Unity 6/6.2. Older Unity versions like 2021.3.45f2, 2022.3.62f2 are working fine.
private async Task GenerateSpeechAsync(string text, CancellationToken cancellationToken)
{
try
{
if (string.IsNullOrWhiteSpace(text)) { return; }
var request = new SpeechRequest(input: text, model: Model.TTS_1, voice: voice, responseFormat: SpeechResponseFormat.PCM);
var stopwatch = Stopwatch.StartNew();
using var speechClip = await openAI.AudioEndpoint.GetSpeechAsync(
request,
partialClip => streamAudioSource.SampleCallbackAsync(partialClip.AudioSamples), //<-- it crashes in this line
cancellationToken)
.ConfigureAwait(true);
var playbackTime = speechClip.Length - (float)stopwatch.Elapsed.TotalSeconds + 0.1f;To Reproduce
I have used Sample project with version 8.8.7. Use any sample scene except Realtime because this one works as expected.
Steps to reproduce the behavior:
- Open the sample project and change the platform to Android
- [optional] Install Android Logcat plugin if you want to see the logs.
- Deploy project to device
- On the title screen select either Chat, Assistant or Response button.
- Say anything or write "hello" to request OpenAI to respond.
- Observe that text response will be displayed and audio will be played for a second then app will crash and exit.
- [Optional] Check Logcat logs for more details
Expected behavior
Should not crash and work as on PC.
Screenshots
Additional context
Sample crash log com.openai.unity-crash.txt
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working