Re: beep

353 views
Skip to first unread message
Message has been deleted

milo.chr...@gmail.com

unread,
Dec 30, 2014, 12:32:49 AM12/30/14
to golan...@googlegroups.com
Why don't you just print the bell char to the terminal? Last time I tried that it worked fine on Windows and I can't imagine it wouldn't work on Linux.

On Monday, December 29, 2014 9:10:22 PM UTC-5, vimcode wrote:
Hi, 
If you're looking for a small program for alerting end of a long running command execution, there is one. It uses cgo with alsa.


Examples:
$ cp -vr directory target; beep
$ ffmpeg -i video.mp4 -vn -acodec libmp3lame sound.mp3; beep -c 10 -f 0.046

Mitranim Forgo

unread,
Dec 30, 2014, 1:46:34 AM12/30/14
to golan...@googlegroups.com
Addendum to the previous answer: to print a bell, include \x07 into a string you're printing. Most Unix terminals output a sound when reading it!
Message has been deleted

Milan P. Stanic

unread,
Dec 30, 2014, 4:44:04 PM12/30/14
to golan...@googlegroups.com
On Tue, 2014-12-30 at 13:26, vimcode wrote:
> I use GNU screen program with vbell off option. Terminal bell is turned off
> because bash beeps for every wrong key strokes.

Such utility is very useful. There is beep at
https://github.com/johnath/beep/ and is packaged for Debian.
I'm using it for headless servers, wifi AP etc in monitoring scripts
as audible alarm.

> On Tuesday, December 30, 2014 12:32:49 AM UTC-5, milo.chr...@gmail.com

Francisco Dalla Rosa Soares

unread,
Dec 30, 2014, 9:34:08 PM12/30/14
to Milan P. Stanic, golan...@googlegroups.com
I like the approach especially because it's pretty easy to modify this to play not only a beep but anything you want and as you said you can have bells off on the terminal (which I do myself) and still be able to play the beeps when necessary.

The only limitation is that by using alsa you end up having a program that is usable pretty much only with linux machines  This could be an interesting learning exercise of how to deal with sound in different platforms by encapsulating the sound part in a function for example and have a different implementation of it for each supported platform.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Milan P. Stanic

unread,
Dec 31, 2014, 9:59:28 AM12/31/14
to golan...@googlegroups.com
N.B. Happy New Year to all!

On Wed, 2014-12-31 at 02:33, Francisco Dalla Rosa Soares wrote:
> I like the approach especially because it's pretty easy to modify this to
> play not only a beep but anything you want and as you said you can have
> bells off on the terminal (which I do myself) and still be able to play the
> beeps when necessary.
>
> The only limitation is that by using alsa you end up having a program that
> is usable pretty much only with linux machines This could be an
> interesting learning exercise of how to deal with sound in different
> platforms by encapsulating the sound part in a function for example and
> have a different implementation of it for each supported platform.

Looks like beep at https://github.com/johnath/beep/ does not use sound
subsystem but console subsystem. Function do_beep in beep.c is short
and could be easily analyzed (and maybe ported to go, but I didn't
tried). And it works even if no one is logged into machine.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages