Shader Sound for Unity
Window > Package Manager > Add package from git URL
Enter the following url and click the add button.
https://github.com/ukeyshima/UnityShaderSound.git?path=/Packages/com.ukeyshima.unityshadersound
If want to see sample scene, please download from Samples.
- Attach ShaderSound class and AudioSource to GameObject
※ Note: An AudioListener is required for any component.
- Write Compute Shader
#include "Packages/com.ukeyshima.unityshadersound/Runtime/Shaders/Include/ShaderSound.hlsl"
[numthreads(8, 1, 1)]
void Main (uint3 id : SV_DispatchThreadID)
{
EARLY_RETURN(id.x)
float time = TIME(id.x);
float beat = TIME2BEAT(time);
float dest = kick(beat);
UPDATE_DATA(id.x, dest)
}