How can I Access/extract raw(headless) audio data from a caf file on iPhone?

前端 未结 2 398
孤独总比滥情好
孤独总比滥情好 2021-01-05 16:19

I am working on a project that requires me to send raw headerless ulaw or linear pcm data to a server.

I am using the AVAudioRecorder and I can save out audio files

相关标签:
2条回答
  • 2021-01-05 16:37

    If you use the Audio Queue API for recording, instead of AVAudioRecorder, you will have access to raw PCM sample buffers, and can write those out to a flat file for later sending to your server.

    0 讨论(0)
  • 2021-01-05 17:03

    If the audio data in the CAF is already in the format you need it in, I'd use the AudioFile API to grab the caf file's audio data and write them to a headerless/RAW file before uploading to my server.

    If you need to convert the CAF's data, use the ExtAudioFile API instead. Either way, pretty straightforward.

    http://developer.apple.com/library/ios/#documentation/MusicAudio/Reference/AudioFileConvertRef/Reference/reference.html

    http://developer.apple.com/library/ios/#documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html

    0 讨论(0)
提交回复
热议问题