Closed Bug 899426 Opened 11 years ago Closed 11 years ago

Samples take a long time to start playing when using web audio

Categories

(Core :: Web Audio, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 937505

People

(Reporter: mwu, Assigned: padenot)

References

()

Details

I attempted to convert the dial tone generator in gaia's dialer app to use web audio, but it takes a lot longer for samples to start playing. Also, if the sample is too short, it doesn't get played at all.
Do you have a test case?
Keywords: testcase-wanted
Flags: needinfo?(mwu)
I've made a simple test case using the DTMF generator used in Gaia's dialer app. - https://people.mozilla.com/~mwu/tonegen/ On desktop, a short delay can be heard when comparing web audio to the original audio data impl. On my Nexus 4, the tone doesn't even play when using web audio with the default buffer size. If you hack the value of kKeyToneFrames2 to 2400, it'll play after a relatively long delay.
Thanks, Michael! Paul, can you please investigate this? Thanks!
Assignee: nobody → paul
Having more delay when using WebAudio is expected _at the moment_: the code path taken when using Audio Data API was: - content javascript - BufferedAudioStream - Cubeb callback - System Now, with webaudio, we have: - content javascript - MediaStreamGraph (adds some latency) - BufferedAudioStream (in conjunction with the slow start of the stream when using the MediaStreamGraph, adds latency) - Cubeb callback - System That said, I'm not sure why it does not play at all on Nexus 4 with the default buffer size, and I don't have a device handy to repro. Etienne is rewriting the dialer using OscillatorNode (which is the right solution anyway), and it seems to work, although I think he mentioned the fact that the delay was a bit higher.
The quick and dirty WIP for Gaia's Dialer can be found here: https://github.com/etiennesegonzac/gaia/compare/web-audio-tone-player
So, a dialer that uses web audio has landed, is now used by default, and I've recently landed a bunch of optimizations related to latency on B2G. This can be closed as WFM.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
(In reply to comment #6) > So, a dialer that uses web audio has landed, is now used by default, and I've > recently landed a bunch of optimizations related to latency on B2G. This can be > closed as WFM. \o/
(In reply to Michael Wu [:mwu] from comment #0) > I attempted to convert the dial tone generator in gaia's dialer app to use > web audio, but it takes a lot longer for samples to start playing. Bug 937505 comment 30 suggests that bug 919215 was at least part of the problem here, but bug 937505 comment 22, and bug 937505 comment 31 seem to indicate that there is still some extra delay in some situations. > Also, if the sample is too short, it doesn't get played at all. This is not bug 943138, because https://people.mozilla.org/~mwu/tonegen/tone_player2.js uses an AudioBufferSourceNode instead of AudioParam.
Resolution: WORKSFORME → DUPLICATE
You need to log in before you can comment on or make changes to this bug.