[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

System Beep?


On 9/03/19 11:03 AM, Steve wrote:
> I tried all three, nothing audio.  I am beginning to wonder if something I the operating system is at fault.
> The three lines do produce symbols.  The first two are a rectangle with a space in the middle and the last one spelled out "bel" in short/small characters.

You've piqued my interest. I haven't worked with sound using Python, but 
a future project, presently graphics/video, could easily expand...

I don't think it is an OpSys fault, per-se. Someone with some 
Python-audio, indeed Linux-audio (in my case) experience may well 
blow-apart my theory, but here goes (E&OE):

Python print()s to files. Normally the shell and a running program will 
print() to the screen. This can be piped or re-directed to a disk-file 
(for example). Thus, many such implementations have no bell to ring!

In the case of Linux, audio has long been problematic. Indeed there are 
Python interfaces to both Alsa and gstreamer. Ahah! Does this mean that 
the Python-OpSys relationship doesn't include sound, natively? ie that 
one interfaces?pipes sound to an audio sub-system rather than the OpSys 

Web-searching for "python sound" produces a number of 'hits'. A quick 
scan revealed a preference for working with audio files, eg mp3, wav; cf 
ASCII (or whatever) characters. I did come across which offers similar facilities to 
those described earlier, from my mainframe days: "it worked", "it 
didn't", "you're a winner!".

A Linux 'solution' which led to my thinking (above):
ossaudiodev ? Access to OSS-compatible audio devices
This module allows you to access the OSS (Open Sound System) audio 
interface. OSS is available for a wide range of open-source and 
commercial Unices, and is the standard audio interface for Linux and 
recent versions of FreeBSD.
(presumably it relates to the Windows i/f others have mentioned)

A survey:
(last edited three years ago)

No date on this one, but comments are very recent:
Play sound in Python
Play sound on Python is easy. There are several modules that can play a 
sound file (.wav).
These solutions are cross platform (Windows, Mac, Linux).
The main difference is in the ease of use and supported file formats. 
All of them should work with Python 3. The audio file should be in the 
same directory as your python program, unless you specify a path.

Playsound 1.2.2 (last release nine months ago)
Pure Python, cross platform, single function module with no dependencies 
for playing sounds.

Pypi has:
762 projects for "sound"

"Python and Sound" is a constructive tutorial which looks a bit old, but 
may suit your application (beyond BEL). However, it uses JES (which I 
came across years-and-years ago, but rejected because it is Java-based 
(bias alert!) which may/not be available for Python (or Jython!?) these 

Regards =dn