Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

System.out.println("\007") generates no sound  RSS feed

 
ammi hiemstra
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use //System.out.println("\007") to send a beep to mij macbook, but I hear nothing.
Does anyone know why and what to do to make it work?
thanks!
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.out.println is for writing to the console or any other PrintStream associated with System.out and not for sounds. What you need is the javax.sounds.midi package.
 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian, (char)7 is the BEL character which does cause a beeping sound to emit from my (Windows) PC.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hm. Didn't know that.
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Young whippersnapper! It was labeled clearly as BEL on my Apple II keyboard.

Printing out either the character or the string produces a beep on my MacBook Pro. Are you sure your speakers are on, the volume is up, you were listening, etc.?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!