0
0

Hi!

I have a problem with function GetSpectrum… On the first, it return values in single type – so that it was such as 1,002494E+09 .. So that, i change it to a Long type. Now is values such as 1024223857 .. But it is so large number… What can i do with this??

Is there some sample in Visual Basic?

Thanks…

Nooanda

PS: Sorry for my english :roll:

  • You must to post comments
0
0

Hay

What version of VB do you use?,IF it’s VB.Net then those numbers are normal, That’s because under VB6 I could create a DSP FFT unit (Using FSOUND_Stream_CreateDSP) and activate it and that worked fine and returned a spectrum valus between (0 and 1) but under VB.Net i couldn’t get CallBacks to work correctly (Fmod problem ,not VB.Net) and i had to just retrieve the spectrum with out creating my own FFT Unit and returned numbers close to yours, but if you are good in math you can use them normally (You will end up with numbers between 9.2 and 10.2).

That’s may case of course, your problem maybe something else.

  • You must to post comments
0
0

I have the same problem i guess. What variable type should the spectrum values be read into? If I use Long, it gives me numbers from 0 to maybe like 400. I changed it to single, but the values are soooo small like 0.0000000000000000000000000000000000004325435 or such. Average user cant see that many percentages change in the graph really. If I power that with something to make it bigger, it looks only like meaningless jumping, not anything to do with music thats playing.
Btw I use vb6 enterprise edition, not .net.

  • You must to post comments
0
0

i dont know much about visual basic but you should cast the result of FSOUND_DSP_GetSpectrum to a pointer to an array of 512 single (ie 4 bytes long) floating point values, check the visual basic help to find out what the type is called

  • You must to post comments
0
0

This piece of code works fine

Public Sub Oscilater4()
Dim ix1, iy1, ix2, iy2
Dim Loopy As Long
If FSOUND_DSP_GetActive(FSOUND_DSP_GetFFTUnit) > 0 Then
Loopy = 0
ix1 = 0
ix2 = 0
iy1 = 0
iy2 = 0
GetSpectrum SpectralData

picSpectrum.Cls

Loopy = 0
Do While Loopy <> 256
iy1 = picSpectrum.ScaleHeight
iy2 = (SpectralData(Loopy) * (picSpectrum.ScaleHeight * (PicPosBottom)))
picSpectrum.Line (ix1, iy1)-(ix2, (picSpectrum.ScaleHeight – iy2)), RGB(0, 255, 0)

ix1 = ix1 + picSpectrum.ScaleWidth / 256
ix2 = ix1
Loopy = Loopy + 1
Loop
Else
‘Enable it first
FSOUND_DSP_SetActive FSOUND_DSP_GetFFTUnit, 1
End If
End Sub

PicPosBottom is just an integer value to increase the spectrum when the volume is lowered, just set it to 1 using normal volume levels (128 – 255). I have it controlled on a slider set between 1 and 30.

Put the code into a timer or into a loop.

Dim SpectralData(256) As Single outside of the routine.

Hope it helps

TBE

  • You must to post comments
0
0

I wanna speak much Word.

But, I cant speak English,, ^^;; I write these words;;..

however, Thankyou very much.

  • You must to post comments
0
0

Oh great that piece of code works beautifully! Thank you all

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.