如何从iPhone上的caf文件中访问/提取原始(无头)音频数据? [英] How can I Access/extract raw(headless) audio data from a caf file on iPhone?

查看:162
本文介绍了如何从iPhone上的caf文件中访问/提取原始(无头)音频数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个项目,要求我将原始无头ulaw或线性pcm数据发送到服务器。

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

我正在使用AVAudioRecorder,我可以很容易地将音频文件保存到手机中,但问题是无论我尝试做什么,它们都会被包裹在一个caf文件中或加盖某种标题。

I am using the AVAudioRecorder and I can save out audio files to the phone quite easily, but the problem is that it no matter what I try and do, they get wrapped in a caf file or stamped with some kind of header.

我的理解是,一个caf文件只是一个原始音频数据的包装文件,这个音频数据可以是各种格式,包括线性pcm和ulaw。

It's my understanding that a caf file is just a wrapper file for raw audio data and that this audio data can be in various formats including linear pcm and ulaw.

所以我的问题是,如何在没有开始使用caf包装的情况下生成原始音频文件(即只是无头的原始文件)如果我录制了一个包含原始Ulaw或线性pcm音频数据的咖啡馆,我怎样才能轻松地从caf文件中提取原始音频数据并将其他所有内容留在后面。

So my questions are, how can I generate a raw audio file without the caf wrapper to begin with (ie just the headerless raw audio stuffed into a file) or if I record a caf that contains the raw Ulaw or linear pcm audio data, how can I easily go in and extract just the raw audio data from the caf file and leave everything else behind.

推荐答案

如果CAF中的音频数据已经是您需要的格式,我会使用AudioFile API来获取caf文件的音频数据并将它们写入无头/ RAW文件之前上传到我的服务器。

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.

如果您需要转换CAF的数据,请改用ExtAudioFile API。无论哪种方式,都非常简单。

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

这篇关于如何从iPhone上的caf文件中访问/提取原始(无头)音频数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆