Hey all! I’m new to FMOD and I’m using it to create an audio visualizer in Unity (so I’m using c#). I have the visualizer working using the getSpectrum function from Unity’s native audio engine, but I’d like to switch to FMOD. Unfortunately, I’m unsure of how exactly to do this.
From what I understand, I need to create a custom DSP, add it to my master channel, and then use the getParameterData function on it in update in order to get the frequency spectrum at every frame.
I suppose my question is…where exactly in my code am I supposed to add the DSP? From looking through the code, it seems the system created by FMOD is only accessible in some editor scripts (from which I cannot call functions), and in a script called “RuntimeManager.cs.” Is RuntimeManager.cs where I’m supposed to add the DSP? Thanks in advanced!
Check the return of the FMOD functions, most will return a FMOD_RESULT.
Specifically check addDSP().
Also, it may sound obvious but make sure the sound is playing before trying to read the data.
Hey Cameron thanks yeah, it was playing, but I was also just using a stand alone song which didn’t seem to read anything. As soon as I created an instance it worked perfectly!
The script works fine but I am having trouble assigning the DSP just to my EventInstance and getting that information fed back into the spectrum visualization.
I am back with a question:
Why does the spectrum buffer always returns one that is only half full?
Ex: if I set a window-size of 512, only 256 samples are useful, the rest is a bunch of zeros.
If I set a window-size of 1024, only 512 are usable and so forth.
Why creating buffers that are half “garbage”? Isn’t that a waste of memory?
My understanding of why this is happening is cause of the nyquist frequency. However, while that makes sense in theory, why putting the filtering in the hands of the end user?
I have the exact same problem but cant find a solution
As you I want do add the FFT-DSP to the channelgroup of the musicInstance but something doesnt work.
Could you describe what the error in your case was? Maybe I have the same
Hi,
I also have the problem that when I add the fft dsp effect to a channelgroup of an event instance i don’t get any data whereas when the effect is added to the master bus all is fine.
How would I solve this?
We now have an example on our website for accessing the Spectrum Data, you will want to get the channelgroup from a Studio::Bus and not from the CoreSystem.