Unfortunately Flash is currently pretty much unavoidable if you want sound effects in JS games.
I experimented with <audio> tag in HTML5 game few days ago: it's fine for media player type applications (where you play longer sounds with looser coupling to user actions), but it's not there yet for games (implementation-wise, API is ok).
If you need to play a lot of tiny sounds in rapid response to player actions, you are going to get random weird behaviors and cross-browser inconsistencies: noticeable lags, cracking noises, cuts and repetitions.
This seems to be heavily depended on the file types you use. I have some experiments with many different, short, sound files running with <audio> just fine - in Chrome, FF and Opera at least.
Ogg Vorbis and (of course WAV) works quite nice, MP3 doesn't. For Safari, maybe AAC would be the right choice. Still, as you said, the <audio> implementation is quite buggy at times. But I have no doubt it will get better!
Yes, a good point. I confirm, also in my experience problems are very dependent on particular sound files. Some work perfectly fine, some make troubles.
And it's not just encoding, it seems to be dependent also on what's inside the sound file like a particular waveform or length.
For me the worst were a sequences of very short sounds (fractions of second) played in a direct response to rapid successive keypresses (keydown-keydown-keydown should make pew-pew-pew). No matter what I did, there was always at least one browser with some showstopping bug.
CoolPreviews, an addon for Firefox, caused the PacMan music to play even when the user wasn't viewing google.com. They've released an update that fixes the issue.
Bad move by google, really. Start on a button click is one thing but auto-starting something that makes a bunch of noise on a page that has always been totally silent is really dumb.
Google doesn't autostart anything, it's a FireFox extension (Cool Previews) that loads the page in the background that causes the trouble. I suggest reading up on the real story before you start labeling things as "bad moves" and "really dumb".
Google is replacing the need for the "I'm feeling lucky" button with their auto-complete system. It's the same effect as the button but is shown in the auto-complete field while the user is typing.
This has the same side effect for Google regarding ads as does the button. Although if a user wants to be taken directly to website ABC they prob aren't a good audience for ads.
Now, when I go to the address bar and type a query whose first Google result I am confident will be the destination I want, I've got a great way to get there.
Example:
"gg imdb Forest Gump"
Will get me to IMDB's Forest Gump page. So you can pretty much imagine the power here, especially for reference sites. Type the site name and the query, and you'll end up where you want to be.
You wouldn't be prepared to write 3,162 lines of code for something with a guaranteed audience of hundreds of millions of people? What does it take for you to get out of bed? Billions of viewers?
This is great, except for that some element of Google (address bar search?) is running in the background of my firefox browser and the siren audio is on a continuous loop even after leaving Google. No add-on or plug-in I remove helps.
95 comments
[ 3.1 ms ] story [ 155 ms ] threadEDIT: I didn't see that you had to click "Insert Coin" to start.
I experimented with <audio> tag in HTML5 game few days ago: it's fine for media player type applications (where you play longer sounds with looser coupling to user actions), but it's not there yet for games (implementation-wise, API is ok).
If you need to play a lot of tiny sounds in rapid response to player actions, you are going to get random weird behaviors and cross-browser inconsistencies: noticeable lags, cracking noises, cuts and repetitions.
Ogg Vorbis and (of course WAV) works quite nice, MP3 doesn't. For Safari, maybe AAC would be the right choice. Still, as you said, the <audio> implementation is quite buggy at times. But I have no doubt it will get better!
And it's not just encoding, it seems to be dependent also on what's inside the sound file like a particular waveform or length.
For me the worst were a sequences of very short sounds (fractions of second) played in a direct response to rapid successive keypresses (keydown-keydown-keydown should make pew-pew-pew). No matter what I did, there was always at least one browser with some showstopping bug.
https://support.mozilla.com/en-US/forum/1/678373
https://addons.mozilla.org/en-US/firefox/addon/2207/
Welcome to HN by the way.
It's working!
This has the same side effect for Google regarding ads as does the button. Although if a user wants to be taken directly to website ABC they prob aren't a good audience for ads.
For example, in Chrome, add this as one of the Search Engines in the options dialog: http://www.google.com/search?q=%s&btnI=Im+Feeling+Lucky
I've associated that with the keyword "gg"
Now, when I go to the address bar and type a query whose first Google result I am confident will be the destination I want, I've got a great way to get there.
Example:
"gg imdb Forest Gump"
Will get me to IMDB's Forest Gump page. So you can pretty much imagine the power here, especially for reference sites. Type the site name and the query, and you'll end up where you want to be.
Most of those sites has an opensearch provider.
http://www.google.com/search?hl=en&site=&q=do+you+fe...
http://pastebin.com/enyeHeKg
EDIT: You wouldn't happen to be Rodger from the nonlogic community, would you?
How's it shakin'?
http://imgur.com/fNjWJ.png
how senior did the approval have to be to get this allowed, do you think?
I liked the plain old google page .. simple
javascript:(function(){var rancidbacon={};try{rancidbacon.com=document.getElementsByName("pm-sound")[0];rancidbacon.com.parentElement.removeChild(rancidbacon.com);}catch(_){}})()
More details here: http://stuff.rancidbacon.com/google-pacman/
http://www.google.com/logos/index.html
That's what they get from not using Canvas or any other technology newer than 10 years old. The game is built of 8x8 pixel DIVs.
(no, not really)