From the creators of SALSA Lipsync
Website: CrazyMinnowStudio.com
Product site: Amplitude
Support email: assetsupport@crazyminnow.com
-
integrations:
-
webgl demos:
Amplitude is a Unity3D asset that provides access to audio amplitude and frequency data on the WebGL platform, where the Unity API does not. It offers a clean and simple custom Inspector, and leverages a standard Unity AudioSource component. The custom inspector communicates with a native JavaScript library, allowing it to make function calls directly against the underlying web browser’s Web Audio API.
- WebGL amplitude and frequency.
- Native JavaScript library accesses Web Audio API directly.
Amplitude is easy to use, simply add the component, link your Unity AudioSource to the Amplitude AudioSource field, set the Data Type (Amplitude or Frequency), set the sample size, and set an amount of boost if desired. Play your audio using the normal Unity AudioSource API. While your audio is playing, Amplitude exposes a float array of the size you specified, and an average. The values range from -1 to 1 for amplitude, and 0 to 1 for amplitude absolute values or frequency.
- Read amplitude/frequency values from the [sample] float array property.
- Read amplitude/frequency average from the [average] float property.
Being the creators of SALSA Lipsync, we of course also created a SALSA lip-sync add-on that allows SALSA to leverage Amplitude for WebGL-based character lip-sync. The SALSA add-on (AmplitudeSALSA) is free for Amplitude customers using the link below.
**AmplitudeSALSA is a separate free download for SALSA customers.
- Combine Amplitude, SALSA, and our free AmplitudeSALSA add-on for WebGL-based character lip-sync.
The sample scene includes a 64 sample UI prefab that allows you to monitor results, and set sample size and data type within a WebGL build.
using UnityEngine;
using UnityEngine.UI;
using CrazyMinnow.AmplitudeWebGL;
public class AmplitudeTester : MonoBehaviour
{
public Amplitude amplitude;
public Slider uiSlider;
// Read the amplitude sample or average values
// while the AudioSource AudioClip is playing
void Update()
{
if (amplitude.audioSource.isPlaying)
{
// Access the amplitude average
uiSlider.value = amplitude.average;
// Or access the sample array
// for (int i = 0; i < amplitude.sample.Length; i++)
// {
// uiSlider.value = sample[i];
// }
}
}
// Example method calls the AudioSource.Play method
public void Play()
{
amplitude.audioSource.Play();
}
// Example method calls the AudioSource.Stop method
public void Stop()
{
amplitude.audioSource.Stop();
}
}