how to output a .wav file?


(Tony) #1

Playsound is ok,but how to output a .wav file?


(Cameron Baron) #2

Depending on what you want to do, it could be as easy as using the output mode FMOD_OUTPUTTYPE_WAVWRITER, or you could make your own DSP to manually output data to a file.

https://fmod.com/resources/documentation-api?page=content/generated/FMOD_OUTPUTTYPE.html


(Tony) #3

Thanks for your reply!

Now I have successfully outputed a .wav file,but I failed to convert the .wav file to a .amr file.

Any solution to this issue?

Thanks in advance.


(Cameron Baron) #4

You would need to use a library or program to do convert the file, as FMOD does not do this.


(Tony) #5

I tried to use opencore-amr to do this,but failed.When the program ran into “SkipToPCMAudioData(fpwave)” ,it looped at

while(!bDataBlock)
{
fread(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
if ( !memcmp(chunk.chChunkID, “data”, 4) )
{
bDataBlock = 1;
break;
}

	fseek(fpwave, chunk.nChunkSize, SEEK_CUR);
}

and never break. Any solutions?
Thanks.


(Tony) #6

I found out that the fmt Subchunk1Size of the outputed .wav file is 40 ,it should be 16 or 18, I think this is reason for the question mentioned above , maybe there is something wrong in the .wav file or I outputed the wav file in a wrong way?Yet,the .wav file can play properly and I can hear the sound.

What’s the reason for this?Any ideas? Thanks.


(Cameron Baron) #7

The subChunkSize will be the size of WAVE_FORMATEXTENSIBLE, which has a size of 40, although this should not be an issue as you are able to use the size to determine the position of the next chunk.