简体   繁体   English

iOS上的录音

[英]Audio Recording on iOS

I've just started working on a project that requires me to do lots of audio related stuff on iOS. 我刚刚开始从事一个项目,该项目需要我在iOS上做很多音频相关的工作。

This is the first time I'm working in the realm of audio, and have absolutely no idea how to go about it. 这是我第一次在音频领域工作,而且完全不知道该如何处理。 So, I googled for documents, and was mostly relying on Apple docs. 因此,我在Google上搜索了文档,并且主要依靠Apple文档。 Firstly, I must mention that the documents are extremely confusing, and often, misleading. 首先,我必须提到这些文件非常混乱,而且常常会产生误导。

Anyways, to test a recording, I used AVAudioSession and AVAudioRecorder. 无论如何,为了测试录音,我使用了AVAudioSession和AVAudioRecorder。 From what I understand, these are okay for simple recording and playback. 据我了解,这些对于简单的录制和播放是可以的。 So, here are a couple of questions I have regarding doing anything more complex: 因此,这是我在做更复杂的事情时遇到的几个问题:

  • If I wish to do any real-time processing with the audio, while recording is in progress, do I need to use Audio Queue services? 如果在录制过程中希望对音频进行任何实时处理,是否需要使用音频队列服务?
  • What other options do I have apart from Audio Queue Services? 除了音频队列服务,我还有什么其他选择?
  • What are Audio Units? 什么是音频单元?

I actually got Apple's Audio Queue Services programming guide, and started writing an audio queue for recording. 我实际上得到了Apple的Audio Queue Services编程指南,并开始编写一个音频队列进行录制。 The "diagram" on their audio queue services guide (pg. 19 of the PDF) shows recording being done using an AAC codec. 他们的音频队列服务指南中的“图表”(PDF第19页)显示了使用AAC编解码器进行的录制。 However, after some frustration and wasting a lot of time, I found out that AAC recording is not available on iOS - "Core Audio Essentials", section "Core Audio Plug-ins: Audio Units and Codecs". 但是,经过一番挫折和大量时间的浪费,我发现iOS上不提供AAC录制-“核心音频基本知识”的“核心音频插件:音频单元和编解码器”部分。

Which brings me to my another two question: 这使我想到了另外两个问题:

  • What's a suitable format for recording, given Apple Lossless, iLBC, IMA/ADPCM, Linear PCM, uLaw/aLaw? 考虑到Apple Lossless,iLBC,IMA / ADPCM,Linear PCM,uLaw / aLaw,哪种记录格式合适? Is there some chart somewhere that someone might be able to refer to? 某处可能有人可以参考的图表吗?
  • Also, if MPEG4AAC (.m4a) recording is not available using an audio queue, how is it that I can record an MPEG4AAC (.m4a) using AVAudioRecorder?! 另外,如果使用音频队列无法进行MPEG4AAC(.m4a)录制,那么如何使用AVAudioRecorder录制MPEG4AAC(.m4a)?

Super thanks a ton in advance for helping me out on this. 超级感谢您提前为我提供帮助。 I'll super appreciate any links, directions and/or words of wisdom. 我将非常感激任何链接,方向和/或智慧之词。

Thanks again and cheers! 再次感谢并加油!

For your first question, Audio Queue services or using the RemoteIO Audio Unit are the appropriate APIs for real-time audio processing, with RemoteIO allowing lower and more deterministic latency, but with stricter real-time requirements than Audio Queues. 对于第一个问题,音频队列服务或使用RemoteIO音频单元是用于实时音频处理的适当API,RemoteIO允许更低和更多的确定性延迟,但与音频队列相比,对实时性的要求更高。

For creating aac recordings, one possibility is to record to raw linear PCM audio, then later use AV file services to convert buffered raw audio into your desired compressed format. 对于创建aac录音,一种可能性是先录制为线性PCM原始音频,然后再使用AV文件服务将缓冲的原始音频转换为所需的压缩格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM