- Home /
c# bandvol
hey so i just got into beat detection and ive found a few posts on bandvol but i have little to no idea how to use it (especially in c#), i can't even get the syntax right in c#.
how will i wrap this in bandvol to control the high and low frequencies?
using UnityEngine; using System.Collections;
public class glitchBehavior : MonoBehaviour {
public AudioListener Audio;
public int numSamples;
int[] numberleft;
public int freq;
int offsetx;
int offsety;
float posX;
float posY;
float scaleX;
float scaleY;
int randomRot;
// Use this for initialization
void Start () {
posX = Random.Range(-3,3);
posY = Random.Range(-2,2);
scaleX = Random.Range(2,4);
scaleY = Random.Range(2,4);
offsetx = Random.Range(5,25);
offsety = Random.Range(5,20);
randomRot = Random.Range(0,360);
gameObject.transform.Translate(posX,posY,0);
gameObject.transform.Rotate(0,randomRot,0);
gameObject.transform.localScale = new Vector3(scaleX,scaleY,1);
}
// Update is called once per frame
void Update () {
float[] numberleft = AudioListener.GetSpectrumData (numSamples, 0,FFTWindow.BlackmanHarris);
gameObject.transform.localScale = new Vector3(scaleX+numberleft[freq]*offsetx,1,scaleY+numberleft[freq]*offsety);
}
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Audio won't fade out. 1 Answer
Playing audio 1 Answer
Fade in AudioLister over time #c 1 Answer