-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uLipSync 3.0.2 not working with WebGL in Unity 2022.3 #57
Comments
Actually found some very useful on the Hecomi website! Thank you! It looks like the plugin is not working in WebGL because OnAudioFilteredRead() is not supported on this platform. Over the next few days I will be trying to use an alternative method. This is what I have so far in case someone in the future finds it useful. In update I have added:
then
There are some issues with this so far:
Benefits over the uezo method would be that we don't go to javascript for sampling the audio data, but due to issue 1) this might not be avoidable, especially for looping clips. |
Hi @horeatrinca , My solution (workaround😅) with uLipSyncWebGL: Step1: Solve compilation error around MicrophoneAdd preprocessor directives for conditional compilation to MicUtil using UnityEngine;
using System.Collections.Generic;
namespace uLipSync
{
public struct MicDevice
{
public string name;
public int index;
public int minFreq;
public int maxFreq;
}
public static class MicUtil
{
public static List<MicDevice> GetDeviceList()
{
var list = new List<MicDevice>();
#if !UNITY_WEBGL || UNITY_EDITOR
for (int i = 0; i < Microphone.devices.Length; ++i)
{
var info = new MicDevice
{
name = Microphone.devices[i],
index = i
};
Microphone.GetDeviceCaps(info.name, out info.minFreq, out info.maxFreq);
list.Add(info);
}
#endif
return list;
}
}
} uLipSyncMicrophone using UnityEngine;
namespace uLipSync
{
[RequireComponent(typeof(AudioSource))]
public class uLipSyncMicrophone : MonoBehaviour
{
#if !UNITY_WEBGL || UNITY_EDITOR
:
:
#endif
}
} Step2: Overwrite uLipSyncWebGL.jslibOverwrite whole code of NOTE: This uses some deprecated WebAudio APIs. Please let me know if you improve it! mergeInto(LibraryManager.library, {
InitWebGLuLipSync: function(targetObjectNamePtr, targetMethodNamePtr) {
const targetObjectName = UTF8ToString(targetObjectNamePtr);
const targetMethodName = UTF8ToString(targetMethodNamePtr);
const outputHookNode = WEBAudio.audioContext.createScriptProcessor();
outputHookNode.onaudioprocess = function (stream) {
SendMessage(targetObjectName, targetMethodName, event.inputBuffer.getChannelData(0).join(','));
};
const connectAudioNodes = function (audioInstance) {
if (audioInstance != null && audioInstance.hasOwnProperty("gain")) {
// connect gain -> outputHookNode
audioInstance.gain.connect(outputHookNode);
// connect outputHookNode -> dest (dummy: no output data will go to dest)
outputHookNode.connect(WEBAudio.audioContext.destination);
console.log("Connected audio nodes successfully");
return true;
} else {
return false;
}
};
const jobId = setInterval(function() {
for (var key in WEBAudio.audioInstances) {
if (connectAudioNodes(WEBAudio.audioInstances[key])) {
// Continuously reconnect gain -> outputHookNode (they will be disconnected silently, I don't know why...)
setInterval(function() {
WEBAudio.audioInstances[key].gain.connect(outputHookNode);
}, 200);
clearInterval(jobId);
break;
}
}
}, 200);
},
}); It works on Chrome and Safari on MacOS. |
thanks @uezo , I have tried the above solution. It works for me on WebGL. I am using Unity 2022.3.13f1 :) |
Hello everyone involved in this discussion, I wanted to provide an update regarding the WebGL compatibility issues with uLipSync that have been reported. First, I appreciate the detailed feedback and the information shared here. They are invaluable for navigating these challenges. Currently, I am actively working on finding good solutions for the WebGL support. I'd like to meet the goal of both supporting various use cases and keeping good maintainability. I wrote an article about my research here: Based on the research, I'm working on the
I will check more use cases and, at the same time, will try to support the microphone input. Thank you for your continued support. |
Happy New Year to everyone. At the end of last month, I released version v3.1.0, which includes the partial support for WebGL. I have resolved several issues that were arising with the I will now be moving on to work on microphone support. |
Thank you very much for your contribution with this tool @hecomi. I'm still having some issues in WebGL about syncronization between audio and lipsync. My application generates speech and plays it at runtime, and the lipsync should follow along to show speech animation (in this case, lipsync data cannot be baked). The problem I'm facing is that even with I thought about the possibility to reproduce in loop a "silent" audioclip when my avatar does't talk, but it seems a not very clean workaround to me, so I first would like to understand if I'm getting something wrong with the tool setup, or if there is something that could be easily improved (I don't know, maybe a temporary workaround could be a method in the api that force the blendshapes to reset?) |
I am having the same issue, @HunterProduction have you found any solution ? |
Thank you for developing an excellent lip-sync tool. Similar to previous requests, I am experiencing an issue where audio generated by an external server (VoiceVOX) stops partway when using WebRequest in a WebGL app to fetch the audio. During development in the Unity Editor, everything works perfectly, and it also works fine when using a static AudioClip after building to WebGL. Could you please provide a solution for this issue? Below is a similar code example for fetching and playing the audio. [YouTube video link: https://www.youtube.com/watch?v=nEfc5X_4FRo] Thank you. This is code for requesting audioclip data.
|
Hi @Yichiron , As a way to isolate the issue, try using a different Text-to-Speech service (such as Google) to see if it works correctly. VOICEVOX likely requires CORS (Cross-Origin Resource Sharing) settings. |
Thank you Uezo, for the advice to use Google TTS! I've already resolved the CORS issue with VoiceVOX using a relay software hosted on Heroku. If it's just about playing the audio, everything works fine even on WebGL. However, I'm having trouble with lip-sync stopping midway. Even though the audio plays, the lip-sync seems to speed up and then stop. I tried Google TTS as well, but the result was the same as with VoiceVOX—the lip-sync moves like at double speed and then stops midway... |
Hi! I'm trying to use the plugin in a WebGL build, but the lips are not moving.
Test procedure:
Result:
Lips are not moving. No errors are shown in the browser console, apart from a warning:
Tested on the latest Firefox and Chrome browsers (Windows 10).
Notes:
JobsUtility.JobWorkerCount = 0;
in uLipSync.cs's awake method.Has anyone solved this issue?
The text was updated successfully, but these errors were encountered: