0
0

i’m trying to figure out how to call getSpectrumData() for MP3 files without having to play the file. i.e. jump to the 30 second mark in the file and grab the spectrum data, then jump to the 31 second mark and grab the frequency, etc…

i tried loading the file using createSound() instead of createStream(), calling playSound() paused, and then changing the position of the channel. this just returns an array of float values real close to zero.

FMOD_OUTPUTTYPE_NOSOUND_NRT looks promising, but i don’t understand the comment … “user can drive the mixer with System::update at whatever rate they want”

Thanks,
casey

  • You must to post comments
0
0

Thanks for the quick reply!

i modified the C# spectrum sample.

after calling system.setOutput(NOSOUND_NRT) it rips through a 7 minute song in about a minute, and getSpectrum() works … great

that sample has a timer that calls system.Update() every 10 milliseconds. if i make the timer delay longer, then it takes longer for the non real time playback to finish … so my remaining question is how far does Update() advance the mixer? can i change that?

casey

  • You must to post comments
0
0

haven’t tested it yet … but i think i figured it out. please let me know if i’m wrong …

but calling system.Update() will process the current sample according to the samplerate set by system.setSoftwareFormat()

BTW FMOD EX is excellent. this will save me a ton of time.

Thanks,
casey
http://www.brains-N-brawn.com

  • You must to post comments
0
0

Thanks for the reply.

from the docs, your tip about DSPBufferSize have it reading a buffer of just over 10ms by default … that the piece i was missing to explain the behavior i’ve been seeing. everything is working as expected now.

Thanks again,
casey

  • You must to post comments
0
0

Hmm, if I call System::update() and then channel->getPosition(TIMEUNIT_PCM) the position only advanced ~940 samples with a buffer size of 1024. Is there a way around this? Or at least a way to accurately calculate how far update() will advance the position pointer?

  • You must to post comments
0
0

That’s probably because your sound is 44khz and the output is 48khz.
yes, 1024/48000*44100 = 940.

Use setSoftwareFormat to make fmod mix at 44khz instead of 48khz and it will advanced without resampling 1024 bytes at a time.

  • You must to post comments
0
0

Oops. feeling stupid now, but thanks a lot! :)

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.