prefered方法重复的声音闪光AS3 [英] Prefered method for looping sound flash as3

查看:127
本文介绍了prefered方法重复的声音闪光AS3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题,循环闪光灯AS3声音,因为当我告诉声音循环,我得到在音频的结尾/开始有轻微的延迟。

I'm having some issues with looping a sound in flash AS3, in that when I tell the sound to loop I get a slight delay at the end/beginning of the audio.

音频正确修剪,将发挥不会对车库乐队的差距。

The audio is clipped correctly and will play without a gap on garage band.

我知道有闪光灯与声音问题在一般情况下,错误与编码和不准确的SOUND_COMPLETE事件(的Adobe应该是不好意思跟人对这些问题的处理)

I know that there are issues with sound in general in flash, bugs with encodings and the inaccuracies with the SOUND_COMPLETE event (And Adobe should be embarrassed with their handling of these issues)

我曾尝试使用内置在Sound类的play方法循环论证,并在SOUND_COMPLETE事件作出反应,但两者引起的延迟。

I have tried to use the built in loop argument in the play method on the Sound class and also react on the SOUND_COMPLETE event, but both cause a delay.

但有没有人想出了一个技术循环的声音没有任何明显的差距呢?

But has anyone come up with a technique for looping a sound without any noticeable gap?

推荐答案

最可靠的方法,如果你能使用Flash Player 10中,是使用新的SampleDataEvent.SAMPLE_DATA事件。

The most reliable method, if you can use Flash Player 10, is to use the new SampleDataEvent.SAMPLE_DATA event.

具体来说,你要做的就是先实例你想要的声音,然后使用新的提取方法,将声音转换成原始的PCM数据连接codeD中的ByteArray。然后,您可以创建一个新的Sound对象,并设置监听它的SampleDataEvent.SAMPLE_DATA事件。当该事件被称为你会推2-8k(低量减少了等待时间,但会增加听觉失真的可能性)从ByteArray中的数据。你只要确保你流掉的ByteArray结束你只环回到开始。

Specifically, what you do is to first instantiate the sound you want, then use the new extract method to convert the sound into raw PCM data encoded in a ByteArray. Then you can create a new Sound object, and setup to listen for it's SampleDataEvent.SAMPLE_DATA event. When that event is called you'll push 2-8k (a lower amount reduces latency, but increases the possibility of audible artifacts) of data from the ByteArray. You'll just make sure that as you run off the end of the ByteArray you'll just loop back to the beginning.

该方法确保你有完全无缝播放。

This method ensures that you'll have fully gapless playback.

这篇关于prefered方法重复的声音闪光AS3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆