beeping under linux

David M. Wilson dw-google.com at botanicus.net
Thu Nov 20 00:45:38 CET 2003


Alexander Schmolck <a.schmolck at gmx.net> wrote in message news:<yfsk75wgn87.fsf at black132.ex.ac.uk>...

> This is only partly a python question, but what is the easiest way to get
> python to (reliably) beep under linux? By reliably I mean that ``print "\b"``
> won't do because it depends on the terminal settings -- so I guess I'm looking
> for some simple way to more or less directly access the internal speaker
> (maybe writing to something in /dev/).

[cape:1:dw]$ setterm -blen 1234 -bfreq 4321 | xxd
0000000: 1b5b 3131 3b31 3233 345d 1b5b 3130 3b34  .[11;1234].[10;4
0000010: 3332 315d                                321]
[cape:2:dw]$ echo $TERM
linux

If by 'reliably', you mean 'override the users choice of having the
speaker on or off', then I think you need a rethink. :)

There are several utilities about that can do the beeping (and music)
for you, and IIRC even ones that work across platforms.


> [The usage scenario is simply to have an effective way of signalling that a
> long running-process finshed, without me having to constantly look at the
> screen]

Suggestion: allow a configurable command to be called, so that users
can choose their own notification method, eg. /usr/bin/play (a part of
'sox').


David.




More information about the Python-list mailing list