How to ring the system bell with Ruby (Win32)

Date August 16, 2008

There a couple ways to accomplish this. My application required the first option because the second wouldn’t work from within Eclipse.

require "win32/sound"
include Win32

Sound.play(SystemAsterisk", Sound::ALIAS) # play system asterisk sound
Sound.beep(600,200) # play a beep 600 hertz for 200 milliseconds

or

irb(main):001:0> puts "\a"
=> nil
irb(main):002:0>

The Ruby on Windows blog has some additional info about Adding Sound to Your Ruby Apps.

(Side note: I’ve posted this because it was almost impossible to find by googling. See for yourself what happens when you search for “ruby ring a bell”- you’ll get about 200,000 false positives.)

Paul Graham at Startup School 2008

Date May 17, 2008

<div><a href='http://www.omnisio.com'>Share and annotate your videos</a> with Omnisio!</div> <p>

Seesmic in Cannes: Indiana Jones - Harrison Ford

Date May 17, 2008

Seesmic in Cannes: Indiana Jones - Steven Spielberg

Date May 17, 2008

Seesmic in Cannes: Indiana Jones - George Lucas

Date May 17, 2008