Amplitude Logo

Check out our newest integrations:

Buy Amplitude on the Asset Store

Amplitude is a Unity3D asset that provides beat detection and amplitude data on the WebGL platform. Unity uses the FMOD audio framework on all of their distribution platforms except WebGL, where they use a wrapper for the browser-based Web Audio API. Unfortunately, this means many of the more sophisticated tools for audio analysis simply are not available on the WebGL platform. Amplitude uses a native JavaScript library to communicate directly with the underlying web browser to access Web Audio API capabilities that have not been exposed by the Unity API wrapper.

* WebGL beat detection and amplitude.
* 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 Sample Size as a multiple of 2 (16, 32, 64, etc.), an amount of boost if desired, and whether or not you want your output to use absolute values. Play your audio using the normal Unity AudioSource API by accessing the AudioSource directly or through Amplitude's AudioSource reference. While your audio is playing, Amplitude exposes a float[] array of the size you specified, and a float average amplitude. The values range from -1 to 1, or 0 to 1 with Absolute Values enabled.

* Read amplitude values from the [sample] float array property.
* Read amplitude average from the [average] float property.

It comes with a clean and simple custom inspector, and of course we created a SALSA lip-sync add-on that allow SALSA to leverage Amplitude for WebGL-based character lip-sync. The SALSA add-on (AmplitudeSALSA) is available for download from our downloads page, free for SALSA customers. You must have SALSA, Amplitude, and the free AmplitudeSALSA add-on to use SALSA on the WebGL platform.

**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.

A sample scene is also included that displays the output from 32 samples, and the amplitude average, while playing a music loop.


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! ~