Question

Is it possible to play basic BIOS sounds with Javascript or Java?
I need sounds that can be played on PC computers without Sound Card.
Every PC has built-in PC speaker that can be useful in this case.

Was it helpful?

Solution 2

pyx4j-native library was helpful for me.

  <dependency>
     <groupId>com.pyx4j</groupId>
     <artifactId>pyx4j-native</artifactId>
     <version>1.0.1</version>
  </dependency>

It have class Beep method beep(int,int).

Play any sound is so easy with this library!

OTHER TIPS

I would use Java and exec an external program:

Runtime.getRuntime().exec("beep.exe"); //not sure Beep.exe is a real thing

Which program to exec? Not sure, but look here for inspiration:

https://superuser.com/questions/227939/how-to-make-the-pc-speaker-beep-from-the-windows-7-command-prompt

or write your own:

http://www.frank-buss.de/beep/

Note that using exec is inherently platform-specific and thus frowned upon in Java. However, what you are trying to do is platform specific, so this is your best option.

Other things worth trying/thinking about:

java.awt.Toolkit.getDefaultToolkit().beep();

But I think that beeps on the soundcard.

And

System.out.print( (char)7 );

but I'm not sure that will always work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top