如何在 Android 上异步同时播放声音(复调)?
想象一下像钢琴一样的基于触摸的应用程序。现在要做的就是将不同的声音文件分配给不同的键。我正在使用 SoundPool 类,但发生了以下问题:
- 声音不同时播放。我很少听到两个声音同时播放
- 播放声音时无法检测到一些触摸
- 响应能力太差,例如,在触摸相应的按键后,声音将播放大约 200-300 毫秒
我见过其他的适用于 Android 的钢琴应用程序,它们在这个部门工作得很好,那么我在这里错过了什么?已经感谢您的阅读。
Imagine a piano like touch based application. Now all that has to be done is to assign different sound files to different keys. I am using the SoundPool class but the following problems are happening:
- The sounds don't play simultaneously. Rarely do I hear two sounds playing together
- A few touches don't get detected when a sound is playing
- The responsiveness is way too bad, for example a sound will play about 200-300 ms after the corresponding key has been touched
I have seen other piano applications for Android and they work fine in this department, so what am I missing here? Thanks already for reading through.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“响应能力太差了,例如,在触摸相应的按键后,声音会播放大约 200-300 毫秒”
考虑检查您的源音频文件吗?我遇到了类似的问题,需要编辑音频文件以消除文件开头的静音。
"The responsiveness is way too bad, for example a sound will play about 200-300 ms after the corresponding key has been touched"
Consider checking your source audio files? I had a similar issue and needed to edit the audio files to strip out silence at the beginning of the file.