Get full spectrum of a sound in Unity

(Jerome) #1

Hello! What I need to do is to get a full spectrum of a whole sound I created (with system.createSound() function).

I tried to adapt code from the answer given [here][1], but I couldn’t find any Unity’s alternative for FMOD_DSP_FFT_SPECTRUMDATA, but also Unity’s getParameterData() function has completely different set of parameters to pass into (index, data and length).

Here’s a snippet of code I have by now (the last line is commented out, because it obviously is wrong):

FMOD.DSP fftdsp;
result = system.createDSPByType (DSP_TYPE.FFT, out fftdsp);
result = channel.addDSP (0, fftdsp);
//result = fftdsp.getParameterData (0, out data, out length);

Am I missing something? Thanks in advance.

P.S. Sorry for posting so many questions lately, just don’t really have time or any advanced knowledge whatsoever to figure this all out by myself.

(Nicholas Wilcox) #2

Use this answer