I’d like to implement something similar to. this in my game. While browsing through Unity’s documentation I noticed it says:
Returns a block of the currently playing source’s spectrum data
GetSpectrumData(samples: float[], channel: int, window: FFTWindow): void;
[B]Description[/B]
Returns a block of the currently playing source's spectrum data.
Would it be possible to pre-analyze a song’s spectrum data and then map the floats as an array to later iterate through a procedural mesh?
something along the lines of
foreach (float in spectrumdata)
{
terrain.setHeight(xPosition,yPosition, BaseHeight * spectrumdata[i]);
}
should get the job done but I’m developing for mobile so analyzing in real-time seems very expensive. Pre-analyzing would also allow me to smooth/average out the floats from the beginning to the end of the song, for a smoother experience.