pythonplaybacknoise

Play simple beep with python without external library


Using only the modules that come with a standard python 2.6 installation, would it be possible to play a simple beeping noise?


Solution

  • If you're on a Unix terminal, you can print "\a" to get a terminal bell:

    >>> def beep():
    ...     print "\a"
    >>> beep()
    

    Of course, that will print a newline too… So sys.stdout.write("\a") might be better. But you get the idea.