[U3] audiosource GetSpectrumData and GetOutputData help

Hi, I’ve been playing around with audiosource’s and am trying to access the data in an assigned audio clip.

Does anyone have any info on how to use GetSpectrumData or GetOutputData as there doesn’t seem to be much in the way of documentation on these methods?

Or do they actually work at all?

Any examples would be brill as well:)

BTW I’m using Unity v3.0.0b4

Thanks All

I’m trying to figure this out too; I’ve managed to get at the data, I’m just not sure how to use it:

var theClip : AudioClip;
function Start () {
audio.clip = theClip;
audio.Play();
var spectrum : float[] = audio.GetSpectrumData (128, 2, FFTWindow.Rectangular);
for (var i = 0; i < spectrum.Length; i++)
	print(spectrum[i].ToString());
}

run that and you’ll see a bunch of values in your console, i.e. 3.315992E-17 - presumably this is an exponential value, so perhaps taking it’s square root or something is called for in order to use these values.

Sometimes my lack of strong math skills is a real handicap…:slight_smile:

Question but why can’t I manage to find GetSpectrumData ?

Unity 3.0 is my guess Akilae.

New sound features.

sorry, this is a Unity 3 function, we’re using the prerelease beta, because we preordered it… be patient, you’ll have this function in hand in a few weeks!