简体   繁体   English

objective-c记录音频会话输出

[英]objective-c record audio session output

I am writing an app that generates music. 我正在写一个生成音乐的应用程序。 I am using OpenAL to: modify gain; 我正在使用OpenAL:修改增益; modify pitch; 修改音调; mix audio; 混合音频; and play the resulting audio. 并播放产生的音频。 I now need to record the audio as it is being played. 我现在需要录制正在播放的音频。 I understand that OpenAL does not let you record the output audio. 据我所知,OpenAL不允许您录制输出音频。 The other options I have found is to use audio units. 我发现的其他选项是使用音频单元。 However because I need to mix/pitch/gain the audio and record it, it seems I need to write all the audio processing so I can have access to the output buffer. 然而,因为我需要混合/音调/获取音频并记录它,似乎我需要编写所有音频处理,以便我可以访问输出缓冲区。 Is this correct? 这个对吗? Or is there a different iOS API I can use to do this. 或者我可以使用不同的iOS API来执行此操作。 If not then is there a 3rd party solution already that lets me record the output (paid solutions are fine)? 如果没有,那么是否已经有第三方解决方案让我记录输出(付费解决方案没问题)?

You are correct. 你是对的。

Audio Units are the only iOS public API that allows an app to both process and then record audio. Audio Units是唯一允许应用程序处理然后录制音频的iOS公共API。

Trying to record the OpenAL output may well be a violation of Apple's rules against using non-public APIs. 尝试记录OpenAL输出可能违反了Apple禁止使用非公共API的规则。

The alternative may be to completely rewrite the portions of OpenAL you need (there may be open source for some portions) running on top of the RemoteIO Audio Unit. 替代方案可能是完全重写在RemoteIO音频单元顶部运行所需的OpenAL部分(某些部分可能有开源)。

The best way to go is likely to be Core Audio, since it will give you as much flexibility as you need. 最好的方法可能是Core Audio,因为它可以为您提供所需的灵活性。 Take a look into the Extended Audio File Services reference pages. 请查看扩展音频文件服务参考页面。

Using and extended audio file you should be able to set up a file format and audio stream buffer to send the final mixed output to, and then use the ExtAudioFileWrite() function to write the samples to the file. 使用和扩展音频文件,您应该能够设置文件格式和音频流缓冲区以发送最终的混合输出,然后使用ExtAudioFileWrite()函数将样本写入文件。

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

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