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”
- kcchesnut asked 11 years ago
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?
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 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.
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?
Please login first to submit.