Question

I'm trying to get SoLoud audio engine working with Emscripten, and it's acting rather strangely. As an experiment, I'm playing a 500ms sine wave.

With a 2048 sample buffer, the latency is around a second or more, and what comes out is 25ms of sine wave. If I reduce the buffer down to 256 samples, the latency gets a bit better (still bad), and the output grows to around, but not exactly, 500ms, and the sound is not clean by any means. This was with firefox; chrome is silent.

The emscripten/tests/sdl_audio* tests all use sdl_mixer instead of the stream directly.

So my question is - is there any way to get streaming audio (so that I do my own mixing and feed sample buffers to some API) to work under emscripten?

Was it helpful?

Solution

Currently, there's a pull request for emscripten to make the SDL implementation use the Web Audio API (it currently uses the Mozilla Audio API, which is why Chrome was silent): https://github.com/kripken/emscripten/pull/1299 In that same pull request, I believe there were many improvements made to the buffer streaming support.

Otherwise, the OpenAL implementation uses Web Audio and has buffer streaming support currently in the master branch.

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