I am trying to write a spectrum analyzer and all I get back is:
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!
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
- ddebono answered 13 years ago
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
Please login first to submit.