I’ve been trying to replicate de WebAudio behavior functions getByteFrequencyData and getByteTimeDomainData.

See doc here: https://webaudio.github.io/web-audio-api/#fft-windowing-and-smoothing-over-time

One would think it would be easily done but strangely enough, I couldn’t find any working example on how to do this with FMOD 4 or 5 (I’m not sure what version 1.08.15 translate to).

The first observation is that, while:

m_Dsp->getParameterData(FMOD_DSP_FFT_SPECTRUMDATA, (void**)&m_Data, &m_DataLength, NULL, 0);

seems to be the closest approximation of the WebAudio API.

WebAudio return decibels while FMOD returns values between 0 and 1. How could we convert the values to decibels, ultimately clamp between 0 and 255?

double maxDecibels = -30
double minDecibels = -100

Also, It seems like WebAudio is performing some smoothing while FMOD does not. What would be a good approach to smooth the frequencies result to visual sounds?

The second is that I couldn’t find any equivalent to getByteTimeDomainData which should represent the down-mixed time-domain (waveform) data. Then again, one would think it is a common thing to do but yet, I couldn’t not find any FMOD documentation on how to do this.

Any insights would be very appreciated, thank you.

  • You must to post comments

There is documentation about capturing/displaying PCM data. it talks about getspectrum and getwavedata which was in fmod ex.

“Add a custom DSP unit to capture DSP wavedata from the output stage.
Use the master channelgroup’s DSP head with
System::getMasterChannelGroup and ChannelControl::getDSP. Add a built
in FFT DSP unit type to capture spectrum data from the output stage.
Create a built in FFT unit with System::createDSPByType and
FMOD_DSP_TYPE_FFT, then add the effect to the master ChannelGroup with
ChannelGroup::addDSP. Use DSP::getParameterData to get the raw
spectrum data or use DSP::getParameterFloat to get the dominant
frequency from the signal.”

Scaling the fft values is up to the user at this point. You might have to scale it yourself based on tests to make it match webaudio, I can’t give you the answer about db at this point.

  • You must to post comments

I see how to get the frequency domain clearly thank you sir. So in short, there is no documentation nor examples on how to get the wave time domain!?

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.