使用 AVAudioRecorder 录制 AVAudioPlayer 输出
在我的应用程序中,用户通过按下按钮来播放声音。 有多个按钮可以同时播放。 声音是使用 AVAudioPlayer 实例播放的。 我想使用 AVAudioRecorder 记录这些实例的输出。 我已经完成所有设置并创建了一个文件并进行录制,但是当我播放它时,它不会播放任何声音。 它只是一个与录音长度相同的无声文件。 有谁知道我是否缺少 AVAudioPlayer 或 AVAudioRecorder 的设置? 谢谢
In my app the user plays a sound by pressing a button. There are several buttons which can be played simultaneously. The sounds are played using AVAudioPlayer instances. I want to record the output of these instances using AVAudioRecorder. I have set it all up and a file is created and records but when I play it back it does not play any sound. It is just a silent file the length of the recording. Does anyone know if there is a setting I am missing with AVAudioPlayer or AVAudioRecorder? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
无法将 AVAudioPlayer 输出录制为 AVAudioRecorder 的输入进行录制。 您可以使用音频缓冲区来存储播放的文件并将其保存到文件中。
It is not possible to record AVAudioPlayer output as input to AVAudioRecorder for recording. You can use audio buffer to store played files and save it to a file.
如果我们看到您的代码,可能会更容易提供帮助。
您还应该查看以下链接,看看您的 AVAudioRecorder 设置是否正确: 如何使用 AVAudioRecorder 在 iPhone 上录制音频?
虽然该链接显示了如何从麦克风设置录音,但它可能仍然对您有帮助。
It would probably be easier to help if we saw your code.
You should also check out the following link to see if you have your AVAudioRecorder setup correctly: How do I record audio on iPhone with AVAudioRecorder?
Although that link shows how to setup a recording from the mic, it might still be helpful to you.
面临着同样的问题。 通过将 AVAudioSession 类别设置为 AVAudioSessionCategoryPlayback 模式解决了该问题。 这是我的工作代码:
另外,请通过实现以下方式确保音频录制已成功完成:
添加
。并检查您是否已在接口声明中
Was facing the same problem. Solved the problem by setting the AVAudioSession category to AVAudioSessionCategoryPlayback mode. This is my working code:
Also make sure that the audio recording has been finished successfully by implementing:
And check that you have added
<AVAudioSessionDelegate,AVAudioRecorderDelegate,AVAudioPlayerDelegate>
in your interface declaration.
希望它能有所帮助,至少可以寻找其他东西。
我在这里遇到了同样的问题,我试图录制在不同时间播放的不同声音与主音轨播放的混合,我发现 AVAudioRecorder 仅从麦克风录制,所以它可以工作。
我发现,仍然需要阅读文档并测试它,是音频转换器服务,我认为这可能有用,但我刚刚读了几行。
再次抱歉地告诉你,你看错了方向,希望我的回答对你有帮助
Hope it helps, at least to look for something else.
I'm having the same issue here, I'm trying to record a mix of different sounds played at different times with a main track playing, what I found is that AVAudioRecorder records only from the mic, so it would work.
What I found, still have to read doc and test it, is the Audio Converter Services, I think that may work, but I have just read a few lines.
Once again, sorry to tell you, but you're looking the wrong way, I hope my answer helps