0
0

Hello there!

My goal is to be able to open any of the various audio formats with FMOD, and export raw PCM data at a sample rate of 48 kHz.

It seems I can do mostly that, but I can’t seem to figure out how to resample the audio to be 48 kHz.


unsigned int length = 0;
unsigned int read = 0;
pSound->getLength( &length, FMOD_TIMEUNIT_PCMBYTES );
unsigned char *buf = new unsigned char[ length ];
pSound->readData( buf, length, &read );
std::ofstream file;
file.open( "test.raw", std::ofstream::binary );
file.write( ( const char *)buf, length );
file.close();

That’s pretty much it, it’s just a requirement that the output is 48 kHz. Is there any way to do that?

  • You must to post comments
0
0

The only time FMOD will resample audio is during live playback. It is not a format conversion tool.

You can hack around it with things like FMOD_OUTPUTTYPE_WAVEWRITER which writes the output of the mix to a wav file, at the rate you set it to (ie 48khz) and you have to use playSound to do it.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.