Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
725 views
in Technique[技术] by (71.8m points)

audio - Recording sound as WAV on iphone

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...