同时录制音频和播放 iPod?
我试图通过 iPhone 的麦克风录制音频,同时播放 iPod 中的音乐。
录音和播放是分开进行的,但如果我尝试从 iPod 播放并同时录音,录音就会停止。
顺便说一句,我实际上并没有录制音频来保存声音文件,而只是对其进行分析。它适用于我的应用程序,它会随着您播放的音乐的节拍而闪烁。
苹果是不是不允许同时录音和播放?
I am trying to be able to record audio through the iPhone's microphone while simultaneously playing music from the iPod.
The recording and playback work separately, but if I try to playback from the iPod and record at the same time the recording stops.
By the way, I am not actually recording the audio to save the sound file, but merely analyzing it. It's for my app that flashes to the beat of the music you play.
Does Apple just not allow record and playback at the same time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够通过将音频会话设置为
AVAudioSessionCategoryPlayAndRecord
来完成此操作。有关这方面的信息在 Apple 文档中,尽管不可否认的是 Core Audio 文档(并且一直)缺乏清晰度。AVSession 类参考
另外,它是值得注意的是,AVAudioRecorder 和 AVAudioPlayer 会自动为您设置会话。您可以使用我上面突出显示的键手动控制和设置会话。
You should be able to do this by setting the Audio Session to
AVAudioSessionCategoryPlayAndRecord
. Information on this is in the Apple docs, although admittedly the Core Audio documentation is (and has always been) lacking in clarity.AVSession Class Reference
Also, it's worth noting that AVAudioRecorder and AVAudioPlayer automatically set the session for you. You can wrestle control and set the session manually using the key I highlighted above.
问题可能是您将音频录制到保存播放文件的同一路径。
尝试使用 AVAudioPlayer 从 url 播放音频,并且您可以同时使用 AVAudioRecorder 进行录制。
干杯:):)
the problem may be you are recording audio to the same path where the playing file is saved.
try to play an audio from a url with AVAudioPlayer and you can record with AVAudioRecorder at the same time.
Cheers :) :)