开发者

HTML5 audio crackle in Chrome

This is a long shot.

The scenario is this: I create audio tags (with the Audio(src) constructor) and play开发者_Go百科 sounds repeatedly in Chrome. The sounds are short, no more than 4 seconds long. Some of those sounds, but not all, get a crackling sound approximately 400ms into the sound (purely based on my ear) and not every time those sounds that are affected play either. In other words; some of the sounds get a crackle sometimes but not always.

So, to figure out why this is I inserted 300ms silence into the sound file. I still got the crackle though, at the same location (which now would be 700ms into the sound). As the search went on I inserted a very discrete hum into the 300ms silence to check if that would change anything. It didn't. So my conclusion from that was that perhaps the crackle came from the audio being at a certain amplitude (since the crackle remained at the same position in relation to the actual sound).

To test this I created a sinewave which went from absolute silence to full volume, but I can't seem to get it to crack. Worth noting is that A. it works flawlessly in IE9, no crackles in any file, so it's not a case of bad files B. it's not all files that seems to be affected by this (I assume it is a) bug.

So the question is: does anyone have any theories why this might be? Anything obvious I'm missing?

I wish I could share some code, but it's all proprietary, and I'm not allowed to do so right now.

EDIT: Actually, I'm not sure the crackle stays in the same position in relation to actual sound no more. I still get a crackle, but it might be at a slightly different place. Sorry for the ambiguous post, I've listened to the same sound the last 5 hours :/. The crackle however are still there and it's still an issue.


I've had this problem with WAV files in Chrome. I think the javascript engine is choking on them. I get the same crackle using audio sequencers when the process is overtaxed. I switched from WAV to MP3 and the crackles stopped.


I also had this problem when using Chrome on a 2011 MacBook Air running Mac OS X 10.7.3. Because there was no crackle when playing the file in Firefox on the same computer, it seemed to be a Chrome bug.

This turned out to be true. When Chrome automatically updated itself to version 17.0.963.56, the crackle problem was fixed:-)

In my opinion, HTML5 audio is still a relatively new beast. For example, only recent versions of mobile browsers actually support it. Last year some mobile browsers said they supported it but actually didn't!

But things are improving. Now, at least I can play audio files in the latest version of Firefox and Chrome on Mac OS X and Android. However, the playback is rarely flawless (slow, skips, crackles, or stops playing). I'm hopeful these problems will subside with each browser update.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜