0
0

Hello again!

This time I need to know, how I could get the waveform data from FMOD. I get the spectrum from FSOUND_DSP_GetSpectrum, but for some visuals I need also the waveform.
So have anyone the code or an idea for getting the waveform data?

  • You must to post comments
0
0

Simply create a DSP module and get data from it. To synchronize DSP buffers with current output you can:
1) set up FMOD with a little buffer, or
2) use internal buffers to store data.

I prefer the second method because it can be applied to both small and large buffers.
Here is an example:
If you set up FMOD with a 250 ms buffer, FMOD will create (250/25)*2 buffers because 250 is the size of buffer, 25 ms are the packets that FMOD uses and *2 means double-buffering.
Now you have are sure that FMOD uses 20 buffers. Now take a variabile that will be incremented on every buffer filling (this should be done in the DSP module), so you’ll have the variable counting from 0 to 19. The buffer pointed from the variable is the last buffer filled, while the current output is at the (variable+(buffers-1)) % buffers. In numerical form:

(variable+19) % 20

Where variable increments of 1 each buffer filling.

I hope I was clear enough! Excuse my bad english!

  • You must to post comments
0
0

OK, thanks.
I think I have understand everything. Now I must try to bring it to code ๐Ÿ˜‰ If something is still unclear, I will ask you again.
And, your english is not worse than mine, but I’m only a german Delphi coder, so ๐Ÿ˜€

  • You must to post comments
0
0

Hm, then I have not seen it. But I’ve found it yet in the sample directory, you’re right ๐Ÿ˜‰ I didn’t find it, because I’m using Delphi and hasn’t looked enough at the c code of the examples. So I will see, what I could use from that sample…

  • You must to post comments
0
0

I need the range and size of the buffer of the DSP routines. Could someone please tell them me (the values, not the c types)?

  • You must to post comments
0
0

The size of the buffer?
You can calculate it simply doing (samplingratebuffersize)/1000.
In a numerical form, for example:
(44100
25)/1000
Then round it to the next multiple of 4 and you got it!
Look that this is the number of samples. To get the number of bytes you have to multiply by 4 bacause of stereo and 16 bit (2 channels * 2 bytes each = 4 bytes per sample!)

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.