0
0

Hello

I’m trying to get the average of Bass values, Medium values and Treble values.

[code:84n1yjyn] BassTotal = MediumTotal = TrebleTotal = 0;

FMOD_System_GetSpectrum(System, Spectrum, 512, 0,FMOD_DSP_FFT_WINDOW_TRIANGLE);

for (i = 0; i<=170; i++)
    BassTotal += Spectrum[i];

Bass = (double)(BassTotal)/170;
cerr << "Bass " << Bass << endl;

for (i = 171; i<= 342; i++)
    MediumTotal += Spectrum[i];

Medium = (double)(MediumTotal)/172;
cerr << "Medium " << Bass << endl;

for (i = 342; i<= 512; i++)
    TrebleTotal += Spectrum[i];

Treble = (double)(TrebleTotal)/170;
cerr << "Treble " << Bass << endl;[/code:84n1yjyn]

I always get this :

[code:84n1yjyn]Bass 1.50737e-007
Medium 1.50737e-007
Treble 1.50737e-007[/code:84n1yjyn]

It never changes…
Before, i was doing it under Fmod 3.75, and i had no problems…
Thanks for your help.

  • You must to post comments
0
0

Is it because you are printing out Bass each time?

  • You must to post comments
0
0

I don’t understand what is the problem to print out Bass each time….

  • You must to post comments
0
0

Because you are printing the same value, 3 times, modify the code to print out bass, medium and then treble, and see what the values are.

  • You must to post comments
0
0

Ah ok, i see, but now, During all the music played, i already get :

[code:1x30p9pi]Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007

Bass 1.50737e-007
Medium 3.58174e-011
Treble 1.50758e-007
[/code:1x30p9pi]
:-/

EDIT : I tried the program under Kubuntu, and there is no problem, i get good output. Is there a problem under Windows to get spectrums ?? :(
I tried to get Bass Medium and Treble with no music, and i get exactelly the same output.

  • You must to post comments
0
0

I change the code to this :

[code:3rip4h6g] FMOD_Channel_GetSpectrum(Channel, Spectrum, 512, 0, FMOD_DSP_FFT_WINDOW_TRIANGLE);

for (int i = 0; i<=170; i++)
    BassTotal += Spectrum[i];

double Bass = (double)(BassTotal)/170;
cerr << "Bass " << Bass << endl;

for (int i = 171; i<= 342; i++)
    MediumTotal += Spectrum[i];

double Medium = (double)(MediumTotal)/172;
cerr << "Medium " << Medium << endl;

for (int i = 342; i<= 512; i++)
    TrebleTotal += Spectrum[i];

double Treble = (double)(TrebleTotal)/170;
cerr << "Treble " << Treble << endl;[/code:3rip4h6g]

But now, I alwais get this :

[code:3rip4h6g]Bass -1.#QNAN
Medium -1.#QNAN
Treble -1.#QNAN
Bass -1.#QNAN
Medium -1.#QNAN
Treble -1.#QNAN
Bass -1.#QNAN
Medium -1.#QNAN
Treble -1.#QNAN
Bass -1.#QNAN
Medium -1.#QNAN
Treble -1.#QNAN
Bass -1.#QNAN
Medium -1.#QNAN
Treble -1.#QNAN
Bass -1.#QNAN
Medium -1.#QNAN
Treble -1.#QNAN
Bass -1.#QNAN
Medium -1.#QNAN
Treble -1.#QNAN[/code:3rip4h6g]

What does -1.#QNAN means ??? 😮

  • You must to post comments
0
0

Have you used a debugger to see what you’re actually adding to your number?

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.