はじめに
「Unity-Beat-Detection」を Unity プロジェクトに導入することで
オーディオのビートとスペクトラムを検知できるようになります
使い方
using UnityEngine; public class Example : MonoBehaviour { public AudioProcessor processor; private void Start() { processor.onBeat.AddListener( OnBeat ); processor.onSpectrum.AddListener( OnSpectrum ); } private void OnBeat() { Debug.Log( "Beat!!!" ); } private void OnSpectrum( float[] spectrum ) { for ( int i = 0; i < spectrum.Length; ++i ) { Debug.Log( spectrum[ i ] ); } } }
上記のようなコードを記述します