Recording sound as WAV on iphone

matt picture matt · Feb 20, 2009 · Viewed 18.1k times · Source

I am making an iPhone recording app that needs to submit the sound file as a .wav to an external server.

Starting from the SpeakHere example, I am able to record sound as a file, but only as .caf

Does anyone know how to record it as a wav instead? Or how to convert from .caf to .wav on the iphone? (The conversion must happen on the phone)

EDIT:

I'm wondering if anything can be done with using kAudioFileWAVEType instead of kAudioFileCAFType in AudioFileCreateWithURL

Answer

matt picture matt · Feb 23, 2009

Yup, the key is kAudioFileWAVEType

AudioFileCreateWithURL (
            audioFileURL,
            kAudioFileWAVEType,
            &audioFormat,
            kAudioFileFlags_EraseFile,
            &audioFileID
        );

Changing to WAVE from CAF in the SpeakHere example causes the recording to be as wav. I also edit the same thing in the playback class, and changed the filename to be Recording.wav