473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 2810
"Jim" <jh*******@smcvt.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*******@smcvt.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/somethingorother,
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*******@smcvt.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/somethingorother,
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
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...
1
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...
0
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...
6
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...
9
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...
17
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....
8
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...
3
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...
2
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...
1
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?....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.