Get sound signal



I’m new at FMOD c++ version.

I’m looking for a way to get the sound signal (f(t)).

I’ve tried this code :
But, it never returns any data…
Could you help me ?


using namespace FMOD;

int main()

System *system;
unsigned int version;
Sound *sound;



std::cout << version ;

system->init(2, FMOD_INIT_NORMAL, NULL);

system->createSound(“essai.mp3”, FMOD_DEFAULT, 0, &sound);

int val = -1;
unsigned int read;
res = sound->readData(&val, 1,&read);

std::cout << val << std::endl;
}while(res != FMOD_ERR_FILE_EOF);
return 0;


Checking the result of readData should help you if there is an issue.

When you create the sound using the FMOD_DEFAULT flag, the file is closed after createSound is finished which will stop readData from working. Using some thing like FMOD_OPENONLY will keep the file open for you to access.


OK, thanks,
But, a question if so, where the data is read when playing sound with the FMOD_DEFAULT flag ?


ReadData is used to decode files into data that you can then use and/or store.
When you create a sound using FMOD_DEFAULT, we open the file and read it into a buffer using readData and then close the file when done.
If you want you can access this buffer using Sound::lock

Otherwise, use FMOD_CREATESTREAM with FMOD_OPENONLY to be able to access the file with readData yourself.