Re: beeping portably

2005-03-22 Thread nicke
On Mon, 21 Mar 2005 10:13:36 GMT
[EMAIL PROTECTED] (Bengt Richter) wrote:

> On 20 Mar 2005 09:03:25 -0800, "Jim" <[EMAIL PROTECTED]> 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/2001/01/31/numerically.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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: beeping portably

2005-03-21 Thread Diez B. Roggisch
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: beeping portably

2005-03-21 Thread Bengt Richter
On 20 Mar 2005 09:03:25 -0800, "Jim" <[EMAIL PROTECTED]> 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


Re: beeping portably

2005-03-20 Thread John J. Lee
"Jim" <[EMAIL PROTECTED]> 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
-- 
http://mail.python.org/mailman/listinfo/python-list


beeping portably

2005-03-20 Thread 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

-- 
http://mail.python.org/mailman/listinfo/python-list