views:

587

answers:

4

I'm revisiting an ID scanner station program we built ages ago and I have a request from users to make a system beep. We're considering moving the system to a web browser, but is it possible to invoke a speaker beep via javascript or something? It doesn't need to be cross-browser compatible, but it probably needs to work on Windows or Linux. The stations in question are not equipped with a soundcard or external speakers, hence the request for a PC speaker access.

I know someone's going to say it, so I'll address this up front: I don't care what you think about applications making noise, this isn't for you. Users request it, it makes sense, and the hardware scanner already makes noise anyways. Yes, we give visual feedback, with distinguishable text and color, but we find that people accept the existing beep as positive feedback and adding more audio context would help.

+2  A: 

This is not possible with native Javascript. You could possibly write an ActiveX control to do it, though.

Gabe Moothart
While the OP said cross-browser compability is not an issue, ActiveX is definitely not the best choice if any form of cross-system (i.e. cross-OS) compability is to be considered.
Alan
@Alan I agree, although Applets make me cringe almost as much as ActiveX does.
Gabe Moothart
+2  A: 

I think your best bet would be a java applet doing the job...

ChristopheD
+8  A: 

Using JavaScript, it's impossible - JavaScript has no access to the client computer except cookies and the new HTML5 local storage.

What you can do, however, is use a Java applet that will be controllable via JavaScript - hidden or not.

You can find an example here.

This requires Java runtime to be installed on the client computer.

LiraNuna
A: 

I honestly haven't tested this, but it would be worth a look,

Real Java's how to emit a beep but it does depend on you being able to ensure your client has an appropriate version of the JDK installed on every machine you are targeting.

Tim Joseph