0
0

What is the fastest way to calculate RMS average from a MP3 file?

I find the sound_lock very slow for this. Is there a faster way?

Flags at creating sound are:
FMOD_SOFTWARE + FMOD_OPENMEMORY + FMOD_CREATESAMPLE

  • You must to post comments
0
0

Nevermind
It was my own code and not FMOD that was slowing down the process..
Now it works fast and fine :)

  • You must to post comments
0
0

You want to share your code to help other people who have the same doubt?

  • You must to post comments
0
0

The main thing I’d suggest is to avoid summing every squared sample value in the window every time. Instead use a sliding window (i.e. subtract the least recent value and add the most recent).

If your feedback loop doesn’t have to be that tight, you could also calculate the RMS’s root function every N samples and average that every sample, instead of performing the root every sample. But if you’re relying on this for critical level control then you probably need to do the root every sample.

If you’re not short of memory, you could implement the root function as a lookup / interpolate.

  • You must to post comments
0
0

By calculating RMS average i was able to draw ok waveform.

how can i draw the waveform of low frequencies only, like 100 Hz?
I remember reading somewhere that the data doesn’t directly tell this, it had something to do with length of waves.

Any ideas?

  • You must to post comments
0
0

Dekon:

If it’s a waveform you’re after, use the direct representation of the signal itself with no processing. The RMS is probably unsuitable for what you want. If you want to see the components around a frequency, you need a bandpass filter or alternatively you can do a fourier transform. It’s impossible, in practical terms, to find exactly what the signal is at 100Hz, but by applying a bandpass digital filter you can approximate it.

As this is getting out of the bounds of support, and into general DSP, I strongly suggest you have a look at some background reading, for example:

Try googling for ‘Butterworth bandpass’ or ‘Chebychev bandpass’

Stephen Bernsee’s DSP dimension has some good tutorials on the DFT/FFT
http://www.dspdimension.com/

Or get your hands on a good book about signal processing e.g. Digital Signal Processing by John G. Proakis, Dimitris K Manolakis

  • You must to post comments
0
0

Thanks for your reply.
Hmm.. FFT seems a bit too hard for me.
I’m using System_GetSpectrum with nosound_nrt to get the data.
Or at least trying to.

I first use the PlaySound function.

Then in a loop:
1) Increase position (Channel_SetPosition) by 10 ms.
2) Call System_Update
3) Call System_GetSpectrum

Each time i get the same spectrum values!
The song position seems to change because in a thread i check the position with Channel_GetPosition and it does increase.

Does System_Update update the spectrum too?

Any ideas?

  • You must to post comments
0
0

I got this solved.
The problem was that i was using libfmodexp.dylib of the stable release and output_nosound_nrt.dylib of the development release.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.