I want to open a stream (mp3 or other) from the disc and to show its entire waveform. I know it’s possible to do that with sample lock/unlock but i don’t want to load it in memory.
Is it possible to load a stream and to read chunck by chunk the informations to show the waveform ? I don’t know how to do that (DSP callback, SetPosition to load the next buffer or other solution…)
thx for ideas/code/sth else
One of the drawbacks of FMOD 3.x in the situation you describe (i.e., working with compressed audio that you don’t want to load in one shot) is that you are limited to bytes and msec. Continuing birty’s comment, you can use the msec length (which will at least give you a DECODED measure) to derive a close estimate of the number of audio samples:
[code:28xaoxpf]lenSamples = (lenTime + 0.5) * (sampFreq / 1000)[/code:28xaoxpf]
But, presumably your full waveform doesn’t need to be sample-to-sample contiguous, right? If the display resolution is even a bit coarse, then you can open the audio as a stream, and then ‘chunk’ through it using msec positions. As you seek to each time position, the sample automatically updates. Lock using offset 0, and the number of bytes that correspond to your step size.
I am in a similar situation, but I must have sample-contiguous stepping, and so my only FMOD option is version 4 (Ex).
- stdev answered 14 years ago
I succeded in having a waveform, using the cdarip example. It works with wav files but i have a problem with ogg. When i call the FSOUND_Stream_GetLength() on a file, it returns the size of the file, not the size of the decoded file !
ie: the file contains 1 200 000 samples so it should be 1 200 000 * 2 bytes (16 bit stereo file). when i call FSOUND_Stream_GetLength() it returns 542 721 which is the exact size of the file on the disk…
Do you know how to obtain the size of the decoded information (without loading sample to memory) ??? Or will i’ll be forced to load everything in memory
Please login first to submit.