• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Beeping  RSS feed

 
Emmy Rauch
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Darin Niard
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Toolkit's beep() uses the system's beep sound, not the bell character.
 
Emmy Rauch
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That explains why it doesnt beep, but my main question is how to beep other pitches, even if I must use the JNI to do this can someone give me an example? Thanks
 
Emmy Rauch
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should I repost this in advanced or give up on life? Eh... I'll do both to have my bases covered.
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thou hast cross-posted... for shame!
 
Junilu Lacar
Sheriff
Posts: 11493
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Emmy Rauch
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I cross posted and still didnt get any info ;-( ... perhaps its not possible? That would be a sad day when you cant produce other tones out of a system speaker in java
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Jules
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!