Hi there !
Is it possible to use the spectrum analyzer for good-looking
demo camera rumble effects ? For example at the moment
where a big bass beat appears, the camera in my 3D demo
rumbles or spins around ?
Ho can I do it ? Is this right ?…
Music1= FSOUND_Stream_OpenFile(“music.mp3”, FSOUND_16BITS | FSOUND_STEREO | FSOUND_LOOP_NORMAL,0);
SpectrumBuffer= FSOUND_DSP_GetSpectrum( );
And how can I use the values in SpectrumBuffer
to create this effect now ?
Thanx for replies !!!
- Megelan asked 15 years ago
The fft transform works linear.
You could transform the data to logarithmic data yourself.
If you want more precision in the lower part, you will have to do a fft transform on a larger piece of data, which means there will be some more lag.
The fft that fmod does at the moment is done on 1024 samples.
What Brett is talking about is adding up the [u:3ednagjc]last[/u:3ednagjc] 32 values, so 480 -512. Then once you get the added values of the last 32 values of SpectrumBuffer you divide the whle thing by 32 to get an average which will range from 0-1. And then with this data you can write a routine to do the effect that you need.
I’m using the SpectrumBuffer up to SpectrumBuffer now
and this looks really cool. Nevertheless I tried your version
SpectrumBuffer up to SpectrumBuffer and get
NO effect…so I think 480-512 is not a good interval.
Anyway thanx for your ideas !
btw. the scale is linear, isn’t it?
So if I use 44.1 kHz, the  is 1 Hz,  is 22050, and  is about 11025?
So [x] = Nyquist/512 * x Hz ?
As mentioned in another forum’s topic, I would be lucky when it would be possible to scale it optionally logarithmic, because (nearly) nobody needs a constant frequence-difference of 43 Hz at 44.1kHz samplingrate.
21533 Hz  & 21576 
There is 43 Hz just a minimal part of a semitone.
But around 100 or 200 Hz a more narrow scale would be nice, there is 43 Hz the half of an octave!
FMOD 4.0 😛 (?)
Please login first to submit.