views:

341

answers:

3

I need quite fast methods for playing sounds/ displaying graphics in a web browser. I came across O3D which does nicely for the 2D graphics aspects but as far as I can tell there is no neat way to play audio from a JavaScript function.

My requirements are that multiply sounds be playable simultaneously and also that each sound start to play quickly (low latency). I'd also like to avoid further plugins if possible. Is this a case of pick any two (out of three)?

Any ideas or suggestions?

+1  A: 

This page might be of interest to you:

"Demonstration of Different Ways to Play a Sound from a Web Page"

It covers this:

  • Normal Hyperlink to a Sound File
  • Embedding a Sound File
  • Controlling an Embedded Sound using JavaScript (New)
  • Using a Background Sound and JavaScript
  • Using Dynamic HTML
  • Using a Java Applet
  • Using a Java Applet called from JavaScript
  • Increasing compatibility with Real Player

It doesn't cover Flash, and you don't seem to want to use it. However, nowadays flash has a large install base. It's not unreasonable to ask visitors to have flash installed if you're going to do advanced audio stuff on your page. Flash works properly on almost every OS and browser that you can think of (unlike silverlight), so I'd definitely consider using it.

Wouter van Nifterick
Afraid all but the Java methods fail in Chrome and Firefox.
..uhhh, I've had real player and embedded sound both work in Firefox before... both in v3 and the newer beta.
DeadHead
+3  A: 

So far I don't know something better than SoundManager. Basically it's Flash wrapper that exposes audio player functionality to JavaScript

zakovyrya
+1  A: 

The Man In Blue (A JavaScript guru) wanted to play with sound on the web with fine control over short sounds (like one might have in a game).

He blogged about it here, and created a demo JavaScript Drum Machine based on it.

That said, if you really want great control, check out SoundManager 2, it provides a fairly robust API.

scunliffe