iphone - 有什么方法可以操纵录制的音频吗?
具体来说,我只是想录制一些东西,反转它,然后播放它。我浏览了苹果文档,但找不到任何有关编辑音频的内容。是否可以?
Specifically, I just want to record something, reverse it, and play it back. I've looked through the apple docs and couldn't find anything about editing audio. Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这绝对是可能的。上次我检查了 Apple Core Audio 文档不是很好,但自从我使用它以来已经有几个月了。以下是我要遵循的步骤。
录制音频样本。
通过循环遍历数组的前半部分并将位于那里的值与距数组末尾等距的值交换来反转音频。
播放生成的音频剪辑。
坦率地说,第一步可能是最难的。 这里是一篇关于在 iPhone 上进行音频(包括录音)的不错的文章。确保您查看了本文的所有不同部分。 这里是另一篇关于在iPhone,但使用不同的框架。实际上有多种方法可以在 iPhone 上进行录音,不过,最后我检查了一下,如果您想在录音时播放音频,则必须使用 RemoteIO。
编辑:
如果您想使用 RemoteIO(我更喜欢),则 这个网站对于开始使用它非常有帮助。另外,Apple 提供的 aurioTouch 示例程序非常有帮助(虽然比你想要的多)。
如果您不需要 RemoteIO(因为它可能是一个很大的痛苦,尽管它更底层,因此更灵活),那么尝试 SpeakHere 示例程序。它只是为了录音和回放而设计的。但是,我只是查看了它,它将记录写入文件而不是缓冲区,这不是您想要的。出于这个原因,我建议使用 RemoteIO(除非您能找到一种方法让它写入缓冲区)。
Yes, it is definitely possible. Last I checked the Apple Core Audio docs were not very good, but it has been a few months since I've worked with it. Here are the steps that I would follow.
Record the audio sample.
Reverse the audio by looping through the first half of the array and swapping the value located there with one an equidistant from the end of the array.
Play the resulting audio clip.
Quite frankly, the first step is probably the hardest. Here is a decent article about doing audio on the iPhone including recording. Make sure you look at all of the different parts of the article. Here is another article about recording sound on the iPhone, but using a different framework. There are really several ways to go about recording on the iPhone though, last I checked, if you want to play audio while you are recording you have to use RemoteIO.
Edit:
If you would like to use RemoteIO(which I preferred), then this site is pretty helpful for getting started with it. Also, the aurioTouch sample program that Apple provides is immensely helpful (though more than you want).
If you don't need RemoteIO (because it can be a major pain though it is more low-level and thus more flexible), then try the SpeakHere sample program. It is made just to record and play back. However, I just looked at it and it writes the recording to a file rather than a buffer which isn't what you want. I would recommend going with RemoteIO for that reason (unless you can find a way to have it write to a buffer instead).