What I attempting to do is to play a short jingle off of the internal system speaker/beeper. I researched this on java.sun.com and found the following sollution:
The problem is that, when I print instruments.length it is -1. I am working on a computer without any speakers but it does have onboard sound. Also System.out.println("\07"); will beep but Toolkit.getDefaultToolkit().beep(); does not. If anyone knows what is wrong with this code or another way to beep other pitches please help. Thanks in advance for your time, Em
I remember back in the days of the Apple ][ (yeah, I'm showing my age but hey, at least I can still remember that far back ) when we could produce tones by toggling the onboard speakers at different frequencies. Of course with that approach you had to take into account the clock speed. I won't even pretend to remember how it was done back then, much less how it can be done on your modern PC. I tried googling around for more info but couldn't find anything.
The big idea with Java is that it's platform-independent, isn't it? (rhetorical) Is it even possible to interface to the system speaker (or bleepy thing, whatever!) in a platform-independent way? Surely it would depend on the hardware you have installed. Given that, there would at least have to be some sort of consistent API on a given platform so that a native implementation could be built and accessed through JNI.
I don't really know enough about it, so maybe I should just shut up.