Changing sound volume

S

simon kagwe

Hi,

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

kyosohma

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-sig/2001-December/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/python-win32/2006-March/004436.html

Mike
 
S

simon kagwe

And finally a way that might work using ctypes:

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
 
K

kyosohma

And finally a way that might work using ctypes:

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
 
L

Lenard Lindstrom

simon said:

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top