提前分析声音 - Actionscript
我想创建一个游戏,可以在现场播放之前几秒钟分析 mp3。基本想法类似于吉他英雄,你可以看到“音品”到来并做好准备,然后他们敲击并与歌曲实时同步。
有没有办法提前分析声音文件,或分析静音的声音文件?
I would like to create a game that would analyze an mp3 a few seconds ahead of where it is playing live. A basic idea would be similar to guitar hero, the 'frets' you can see coming and prepare, then they hit and sync with the song in real time.
Is there a way to analyze a Sound file ahead of time, or analyze a muted Sound file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Sound.extract() 访问底层音频数据。您还可以通过向 Sound 对象添加 SampleDataEvent 侦听器来动态地将样本提供给 Sound 对象,并在不为其提供 mp3 的情况下播放它。
所以基本上这个过程通常是这样的:
虽然我不明白你到底想做什么,但听起来你会让你的提取过程在播放过程之前进行几秒钟 - 提取到缓冲区 ByteArray,进行分析,然后复制每次输出 Sound 请求更多样本时,都会从缓冲区 BA 的开头开始采样。
You can get access to the underlying audio data with Sound.extract(). You can also feed samples to a Sound object dynamically by adding a SampleDataEvent listener to it and playing it without providing it with an mp3.
So essentially the process usually looks like this:
While I don't understand exactly what it is you're trying to do, it sounds like you'd keep your extraction process going a couple seconds ahead of your playback process - extracting to a buffer ByteArray, doing your analysis, and then copying samples from the beginning of that buffer BA every time the output Sound requests more samples.