Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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.

like image 754
Oskar Eriksson Avatar asked Aug 05 '11 12:08

Oskar Eriksson


1 Answers

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.

like image 180
Andy Ward Avatar answered Sep 18 '22 15:09

Andy Ward