By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,400 Members | 903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,400 IT Pros & Developers. It's quick & easy.

beeping portably

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.