473,805 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

beeping portably

Jim
Hello,

I'd like to emit beeps. The twists are that (1) I hope to have control
over the frequency of the beeps and their duration and (2) I'd like the
solution to be portable across Linux, Windows, and OS X.

I've done some searching of this group and the solutions that people
have offered in the past seem not to satisfy both points. For instance,
that I can tell, "\a" or curses.beep() doesn't give you control over
the frequency or duration. I also looked at wxWindows but there were
warnings about the MMedia module ("status is unclear") that made me
leery.

Thanks,
Jim

Jul 18 '05 #1
4 2832
"Jim" <jh*******@smcv t.edu> writes:
I'd like to emit beeps. The twists are that (1) I hope to have control
over the frequency of the beeps and their duration and (2) I'd like the
solution to be portable across Linux, Windows, and OS X.

[...]

PyGame? If it's too big for you, you could always borrow code from it.
John
Jul 18 '05 #2
On 20 Mar 2005 09:03:25 -0800, "Jim" <jh*******@smcv t.edu> wrote:
Hello,

I'd like to emit beeps. The twists are that (1) I hope to have control
over the frequency of the beeps and their duration and (2) I'd like the
solution to be portable across Linux, Windows, and OS X.

I've done some searching of this group and the solutions that people
have offered in the past seem not to satisfy both points. For instance,
that I can tell, "\a" or curses.beep() doesn't give you control over
the frequency or duration. I also looked at wxWindows but there were
warnings about the MMedia module ("status is unclear") that made me
leery.

for windows, I think it's
http://docs.python.org/lib/module-winsound.html
but I don't know if there's a corresponding *nix module.
Or maybe you can make one just writing to some /dev/somethingorothe r,
and conditionally set up the appropriate thing for limited
platform-appropriateness if not independence.

Regards,
Bengt Richter
Jul 18 '05 #3
Jim wrote:
Hello,

I'd like to emit beeps. The twists are that (1) I hope to have control
over the frequency of the beeps and their duration and (2) I'd like the
solution to be portable across Linux, Windows, and OS X.

I've done some searching of this group and the solutions that people
have offered in the past seem not to satisfy both points. For instance,
that I can tell, "\a" or curses.beep() doesn't give you control over
the frequency or duration. I also looked at wxWindows but there were
warnings about the MMedia module ("status is unclear") that made me
leery.


Maybe pygame helps? You can play sound with it, and the sdl abstracts from
directx and whatever linux uses.

--
Regards,

Diez B. Roggisch
Jul 18 '05 #4
On Mon, 21 Mar 2005 10:13:36 GMT
bo**@oz.net (Bengt Richter) wrote:
On 20 Mar 2005 09:03:25 -0800, "Jim" <jh*******@smcv t.edu> wrote:
Hello,

I'd like to emit beeps. The twists are that (1) I hope to have control
over the frequency of the beeps and their duration and (2) I'd like the
solution to be portable across Linux, Windows, and OS X.

I've done some searching of this group and the solutions that people
have offered in the past seem not to satisfy both points. For instance,
that I can tell, "\a" or curses.beep() doesn't give you control over
the frequency or duration. I also looked at wxWindows but there were
warnings about the MMedia module ("status is unclear") that made me
leery.

for windows, I think it's
http://docs.python.org/lib/module-winsound.html
but I don't know if there's a corresponding *nix module.
Or maybe you can make one just writing to some /dev/somethingorothe r,
and conditionally set up the appropriate thing for limited
platform-appropriateness if not independence.

Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list

You could generate sine tones quite easily. see e.g.
http://www.onlamp.com/pub/a/python/2...merically.html, which
you save in an array or list. What you have then is the amplitude for
sound frames, which is just what is stored in a sound file(and played).
For audio of 11025Hz that would be 11025 frames(values) per second. I
don't know about other sound devices, but ossaudiodev accepts these more
or less directly.

At least array.array can then pack those values into strings. Those you
could then save to sound files with the wave module. Playing you could
do with for example tkSnack, which is cross-platform. (haven't tried
though)

good luck, Niklas
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
25013
by: Alexander Schmolck | last post by:
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/). 'as
1
1848
by: Herman Geldenhuys | last post by:
I am dialing a modem(COM3) from python on windoze and I connect successfully to a remote phone, but there is an annoying beeping sound that keeps on ringing in the background. Would anybody happen to know what command and in what sequence I should send to the modem to make it stop? Thanks H
0
1119
by: adrian | last post by:
Hi, I'm using SnmpSendMsg from within VB.net 2005, everything is working fine but occasionally calling SnmpSendMsg causes a system exclamation beep. As I'm querying several values this causes repeated beeping for no appearent reason as the call functions correctly. A reboot seems to clear the problem but it would be nice to know the
6
1670
by: Tom E H | last post by:
My Python application includes some data files that need to be accessed by modules I distribute with it. Where can I put them, and how should I arrange my code, so that it works across platforms? On Linux, I could install the data to "/usr/lib/myprogram/datafile", and on Windows to "datafile" relative to where the executable (made by py2exe) is installed. Then I could detect the operating system, and choose appropriately.
9
6605
Subsciber123
by: Subsciber123 | last post by:
I am running a program that I wrote (a compression program {it is not finished yet}), and when I run it, my computer makes a continuous beeping sound (the same sound your computer makes if you press too many keys at once on the keyboard {in windows}). What is the cause of this beeping noise?
17
2398
by: Michael Hoffman | last post by:
What's the best way to portably generate binary floating point infinity and NaNs? I only know two solutions: 1. Using the fpconst module proposed in IEEE 754, which I believe shifts bits around. 2. Using an extension module (for example, numarray.ieeespecial will do it). I thought of using float(Decimal("nan")), but apparently Decimal.__float__(self) is float(str(self)), which isn't portable.
8
2544
by: Marcus Kwok | last post by:
Is std::string::npos portably able to be incremented? For example, I want to insert some text into a string. If a certain character is found, I want to insert this text immediately after this character; otherwise I insert at the beginning of the string. On my implementation string::npos has the value of (string::size_type)-1, so incrementing it will make it 0, but can I rely on it? Also, say that the character occurs at the end of...
3
4333
by: tbroberg | last post by:
I have some pretty heavily optimized old code written to be nice and portable in a 32-bit environment. In places, it needs to check the lowest few bits of various pointers for alignment. Now I am porting this code to 64-bit environments including MS and gcc, and whatever modern and near-future systems my customers and customers-to-be are likely to run on.
2
1195
by: John Nagle | last post by:
There doesn't seem to be any way to portably kill another process in Python. "os.kill" is Mac/Unix only. The "signal" module only lets you send signals to the current process. And the "subprocess" module doesn't have a "kill" function. Subprocess objects really should have a portable "interrupt" or "kill" function. They already have "poll" and "wait", which have to be implemented differently for different systems; that's the logical...
1
3354
by: tvnaidu | last post by:
MY PC (windows 2000 prof) keep beeping - if I mute audio also beeping - looklike motherboard beeping. It just started today, earlier no beep at all, suddenly started. any diagnostic tip?. appreciated.
1
10369
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.