0
0

I am trying to write a spectrum analyzer and all I get back is:

0.0000256
1.561996E-09
1.562004E-09
5.207365E-10
1.562033E-09
3.123834E-10
5.207585E-10
2.232088E-10
1.562151E-09
1.735606E-10
3.124201E-10
1.420327E-10
5.208468E-10

The first number is ok but the rest of them are invalid I think.

Here is the code I am using:

Dim SpecArr(512) As Single
result = FMOD_System_GetSpectrum(System, SpecArr(0), 512, 0, FMOD_DSP_FFT_WINDOW_TRIANGLE)

This has me stumped. I know the is a answer. I know I must be stupid.

It sure would help us programmers if there was a example piece of code for each language included in the docs.

Thanks guys for making this available for freeware use!

Mike

  • You must to post comments
0
0

No your’e not stupid.

The values returned from the finction is between 0 and 1.

The reason for the E-9/E-10 is that the value is very small and cannot be shown. This is a mathematically correct representation. So if you move the decimal separator the number of times to the right that is says in the E- you will get the correct value.

But VB handles this correctly internaly, so it’s nothing to worry about.

The value 1.561996E-09 is actually 0.000000001561996

  • You must to post comments
0
0

Thanks for the info. Now I can maybe get it to work. I just thought they were way to small or the numbers were wrong. I didn’t know for sure.

Mike

  • You must to post comments
0
0

2 Unlimited – Tribal Dance.Mid is not a very silent song. Besides I stuck a copy of the numbers into a file every time I did the loop and everytime the numbers came out the same way. The first number looked right but all the others came out very small numbers. Here is the routine as I have it:

Private Sub tmrTimer1_Timer()

Dim SpecArr(512)    As Single
Dim x        As Long
Dim i As Long
Dim H As Long
Dim W As Long
Dim Segments As Long
Dim Fnum As Long
result = FMOD_System_GetSpectrum(System, SpecArr(0), 512, 0, FMOD_DSP_FFT_WINDOW_TRIANGLE)

For i = 0 To 511
    Segments = CInt(SpecArr(i) * 1000000000)
    H = posHeigth - (Segments * SegHeigth)
    picSpectrum.Line (x, posHeigth)-(x, H), vbWhite
    x = x + SegWidth
Next i

End Sub

Mike

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.