471,349 Members | 1,266 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Changing sound volume

Hi,

I am playing sounds using the winsound module. Is there a way I can change the
volume?

Jun 23 '07 #1
5 11992
On Jun 23, 7:47 am, simon kagwe <simonka...@yahoo.comwrote:
Hi,

I am playing sounds using the winsound module. Is there a way I can change the
volume?
The docs don't mention anything about controlling the volume, so I
doubt it's possible with winsound. However, I found this in the
archives:

http://mail.python.org/pipermail/edu...er/001899.html

It's some kind of wrapper for Snack that allows you to mess with the
volume. This site talks about Snack, winsound and another module:

http://www.zak.co.il/gpl/misc/eng/pythonsound.html

And finally a way that might work using ctypes:

http://mail.python.org/pipermail/pyt...ch/004436.html

Mike

Jun 24 '07 #2
And finally a way that might work using ctypes:
>
http://mail.python.org/pipermail/pyt...ch/004436.html

Mike
Hi,

Thanks for your reply.

I had already read about the Snack, but I can't use it since my program uses
wxPython for the GUI and Snack requires tk. The best option was the ctypes
method you told me about. I used the code in the sample, but I am getting the
following error:

exceptions.WindowsError Error 11 while setting volume

The author of the code claims it works. What could be causing the above error?

[ I am using Python 2.4.4 and ctypes 1.0.1 ]

Regards,
Simon


Jun 25 '07 #3
simon kagwe a écrit :
Hi,

I am playing sounds using the winsound module. Is there a way I can change the
volume?
Maybe with pyGame, but you may have to switch from winsound to
pygame.mixer.music

http://www.pygame.org/
http://www.pygame.org/docs/ref/music.html

A+

Laurent.
Jun 25 '07 #4
On Jun 25, 7:48 am, simon kagwe <simonka...@yahoo.comwrote:
And finally a way that might work using ctypes:
http://mail.python.org/pipermail/pyt...ch/004436.html
Mike

Hi,

Thanks for your reply.

I had already read about the Snack, but I can't use it since my program uses
wxPython for the GUI and Snack requires tk. The best option was the ctypes
method you told me about. I used the code in the sample, but I am getting the
following error:

exceptions.WindowsError Error 11 while setting volume

The author of the code claims it works. What could be causing the above error?

[ I am using Python 2.4.4 and ctypes 1.0.1 ]

Regards,
Simon
I'm not sure what the deal is. I just tested that script on my
workstation and it works fine for me. I think I have the latest
ctypes, but I can't figure out how to get the version number off of it
to be sure. I am running Python 2.4.3 on Windows XP SP2 though.

You might try that pygames idea. I've never tried it, but you'd think
that would work.

Mike

Jun 25 '07 #5
simon kagwe wrote:
>And finally a way that might work using ctypes:

http://mail.python.org/pipermail/pyt...ch/004436.html

Mike

Hi,

Thanks for your reply.

I had already read about the Snack, but I can't use it since my program uses
wxPython for the GUI and Snack requires tk. The best option was the ctypes
method you told me about. I used the code in the sample, but I am getting the
following error:

exceptions.WindowsError Error 11 while setting volume

The author of the code claims it works. What could be causing the above error?

[ I am using Python 2.4.4 and ctypes 1.0.1 ]
That module looks suspiciously like one I have laying around on my
computer. That's okay since I had posted it somewhere. Try setting
SPEAKER_LINE_FADER_ID to 0. Apparently my assumption that it is always 0
was wrong. If that works I have a more flexible version of the module
which actually searches for the speak line fader id. It also has a
GetSpeakerVolume function.

---
Lenard Lindstrom
<le***@telus.net>
Jun 25 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by murrayatuptowngallery | last post: by
2 posts views Thread by scottech | last post: by
4 posts views Thread by Robert Gravereaux | last post: by
7 posts views Thread by Lee Moody | last post: by
3 posts views Thread by Andreas Hecker | last post: by
reply views Thread by =?Utf-8?B?TmljayBIb2x3YXk=?= | last post: by
3 posts views Thread by Memozio | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.