Get raw PCM data

Hello, I’m trying to get raw PCM data from MP3 file just by opening the file and calling lock() and unlock() but don’t get any sound when I’m trying to play sound from memory, does lock() even return raw PCM data by just opening the file?

Found out that Sound::readData does just what I need.

1 Like

Does really readData() gives PCM data if I createSound() with mp3 file?

You are able to get the PCM data from readData, we also have an example doing this in our docs https://www.fmod.com/docs/api/core-guide.html#extracting-pcm-data-from-a-sound.

I’ve followed this already. If the audio is wav format, I can successfully get the PCM data.
But if the audio is in mp3 format, I can some data. But I don’t know what that data means.
Let me clarify a bit. If my audio is a wav file, I could successfully read each sample. I could draw wave from that data.

But if my audio is mp3 file, I can’t read the sample data after doing readData(). I am failing to get at which structure these data are in. I can’t read each sample. I can’t make wave out of it.

Can you help me here?

By wave I mean of what we see in many music player application, on the x-axis time and on y axis amplitude.

It could be caused by calling createSound with FMOD_CREATECOMPRESSEDSAMPLE

Your other thread would be a better place to continue this discussion: