Question

When synthesising sound using the SAMPLE_DATA event of the Sound class, the Flash documentation recommends writing out as many samples as possoible up to 8192. On my system the sound cuts out unless I write at least 4192 samples each event. That's a full tenth of a second, which is going to be user-noticeable.

I may have the option of buffering things up ahead of time, but this is a major annoyance for my application. Is there any way of getting lower latency audio output?

Was it helpful?

Solution

Unfortunately, SAMPLE_DATA is the main means of synthesizing audio, and it has varying performance and latency between platforms. For the smallest latency, the best you can do is provide as few samples as possible (2048) in the SampleDataEvent.

There is also Sound.loadPCMFromByteArray, which was added in Flash Player 11 and allows you to load samples directly into a normal Sound object. Although this wouldn't be helpful for real-time, dynamic audio synthesis, it allows you to pre-generate the sound and play it back whenever you need it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top