录制直播音频
我实际上正在制作一个应用程序,它必须在 iPad 上播放和录制来自互联网的流媒体音频。音频流已经完成,我很快就要进入录音部分,我不知道如何继续。
你能给我提示吗???主意?它必须在播放的同时录制为 AAC 或 MP3。
谢谢。
I'm actually making an app which has to play and record streaming audio from internet on ipad. The streaming of the audio is done, I will have to come to the recording part very soon and I don't have any idea on how to proceed.
Could you give me a hint??? Idea? It will have to play while simultaneously recording into AAC or MP3.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用较低级别的 AudioQueue API,并使用 AudioSession API 来设置音频会话。
然后,您需要填写
AudioStreamBasicDescription
结构,并使用AudioQueueNewInput()
创建一个新的输入队列,并包含用于处理输入缓冲区的回调函数。然后,您需要使用
AudioQueueAllocateBuffer()
和AudioQueueEnqueueBuffer()
创建 3 个缓冲区。只有这样您才能准备好调用AudioQueueStart()
。您还应该处理音频会话中断,并处理停止音频队列。这只会为您提供包含未压缩的 16 位整数 PCM 音频数据的缓冲区流。您仍然需要压缩数据,这是另一种涉及使用 AudioConverter API 的蠕虫病毒,我还没有在 iPhone 操作系统上这样做过,所以我不知道在那里会发生什么。
You'll need to use the lower-level AudioQueue API, and use the AudioSession API to set up the audio session.
Then you'll need to fill out an
AudioStreamBasicDescription
struct and create a new input queue withAudioQueueNewInput()
and include your callback function for handling input buffers.And then you'll need to create 3 buffers using
AudioQueueAllocateBuffer()
andAudioQueueEnqueueBuffer()
. And only then will you be ready to callAudioQueueStart()
. You should also handle audio session interruptions, and handle stopping the audio queue.That will just get you a stream of buffers containing uncompressed 16-bit integer PCM audio data. You still need to compress the data, which is another can of worms that involves using the
AudioConverter
API, which I haven't done on the iPhone OS so I don't know what will work there.请看看这个框架。它在录制时提供录制数据 Streaming Kit
通过 HTTP 播放 MP3
并将其数据附加到 NSMutabledata 以离线播放通过使用这个委托。
在播放前拦截 PCM 数据
Please Look at this Framework. It provide data for recording while recording Streaming Kit
Play an MP3 over HTTP
And append its data to NSMutabledata to play offline by using this delegate.
Intercept PCM data just before its played