如何以编程方式播放录制声音以及如何播放录制的音频?
我正在开发一个应用程序。我想录制声音并播放录制的声音文件。我知道执行此操作的框架。但是如何使用该框架以编程方式进行开发呢?
I am developing one application. In that I want to record the sounds and I want to play that recorded sound file. I know the frameworks for doing this. But how to develop programmatically by using that frameworks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以参考此链接:
我已在我的一个应用程序中实现了此代码,并且它工作得很好。
如何使用 AVAudioRecorder 在 iPhone 上录制音频?
为了播放声音,您可以选择使用 AVAudioRecorder。
希望这有帮助。
You can refer to this link:
I have implemented this code in one of my apps and it works completely fine.
How do I record audio on iPhone with AVAudioRecorder?
For Playing the sound you have option to use AVAudioRecorder.
Hope this helps.
最好的方法——我在这里谈论的是痛苦的经历——是使用 RemoteIO 音频单元。您也可以使用 AudioQueue 来实现,但它的延迟较高,并且队列类型的方法变得非常有问题。
所以,我认为它们对于不同的工作来说确实是不同的工具。请注意,您不会播放这样的声音文件。您将播放内存中保存的缓冲区的内容。只要缓冲区不是太大,这应该不是问题。
因此,使用 RemoteIO,您会发现此博客和教程非常有用。它包括代码示例。
使用 RemoteIO 音频单元 作者:MICHAEL TYSON
The best way to do it - and I am talking from painful experience here - is with the RemoteIO audio unit. You can also do it with AudioQueue, but it has a higher latency, and the queue type approach becomes very problematic.
So, I think that they are really different tools for different jobs. Note that you won't play a sound file as such. You will play the contents of a buffer held in memory. As long as the buffer is not too large, this should not be an issue.
So, going with RemoteIO, you will find this blog and tutorial very useful. It includes code samples.
Using RemoteIO audio unit By MICHAEL TYSON