Please note: We use affiliate links for all assets linked to Unity from our pages. These links do not affect your cost or the publisher's revenue and help us continue to improve our products. We sincerely thank you for your support.

Buy Amplitude on the Asset Store

 

NOTE: Please ensure you have the correct Amplitude build for your Unity version. See the Documentation Overview page for details.

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 provides results similar to Unity's GetOutputData and GetSpectrumData methods available on other platforms.

Amplitude 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 audio 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 or frequency values from the [sample] float array property.
* Read amplitude or 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 download and not included in the Amplitude asset.

* 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();
    }
}

NOTE: While every attempt has been made to ensure the safe content and operation of these files, they are provided as-is, without warranty or guarantee of any kind. By downloading and using these files you are accepting any and all risks associated and release Crazy Minnow Studio, LLC of any and all liability.

Amplitude for WebGL
~ Make your web audio move! ~