473,386 Members | 1,867 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,386 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 12672
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Keyser | last post by:
On most my pages, I use Javascript to play a sound. It works fine in Netscape 4.7, Netscape 7.2, Firefox 1.0, IE5 and IE6 using Windows98 as the operating system. However, using WindowsXP as the...
4
by: murrayatuptowngallery | last post by:
I have looked at some mouseover/ sound object scripts and can't get them to work. Most were more complex than needed and introduced several new parameters for me. I found a simple pair of html...
2
by: scottech | last post by:
I'm not sure if this is the 'right' place to post -- I'm just getting used to the VB newsgroups, but I need assistance and am hoping I can either get the assistance or some help in pointing me the...
4
by: Robert Gravereaux | last post by:
I'm putting together a C# .Net forms project on win2k. The application requires some sort of horn sound. I've never implemented any audio in .Net, so I'm not sure how best to accomplish this. ...
7
by: Lee Moody | last post by:
I just want quick and easy way to play a .wav file out the standard sound device. It could even be as simple as activating a sound assigned to an existing windows sound event. Any suggestions?...
3
by: Andreas Hecker | last post by:
Hello, when i play a sound file like mp3 or wav with MediaPlayer or anything like this, i would like to get the volume level of the sound card in real time. The data is then sent to the serial...
0
by: =?Utf-8?B?TmljayBIb2x3YXk=?= | last post by:
I'm trying to follow a tutorial (1) on getting and setting a sound card's volume. It uses a function in winmm.dll public static extern int waveOutGetVolume(IntPtr hwo, out uint dwVolume); ...
3
by: Memozio | last post by:
Is there a library in python that has methods applicable to volume(in terms of sound) of a given file? For example if it can check if the sound volume of a file is on the same level for the entire...
26
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.