[Tutor] accessing the mixer
dyoo at hkn.eecs.berkeley.edu
Wed Nov 19 18:41:31 EST 2003
On Tue, 18 Nov 2003, Larry wrote:
> I am trying to access the mixer in order to build a simple volume
> control, for now. (:
> Anyway I have found very little on google about doing anything at all
> with the mixer, though I have found ossaudiodev in the 'python library
> reference', so I'm trying to work from that.
> But now I find that my library reference in /usr/doc/python/html has no
> ossaudiodev listing in it.
Hmmm... That's odd. Here's a link to the official documenation on the
but it only works for Unix systems. I wonder why it's missing from your
If you're on a system that supports the ossaudiodev module, then the
following example might work:
mixer = ossaudiodev.openmixer()
mixer.set(ossaudiodev.SOUND_MIXER_VOLUME, (50, 50))
This should set the left and right channels of the master volume to 50%
But that example probably won't work on Windows. I'm not exactly sure if
there's a nice platform-independent way to access the global volume
control; does anyone else know about it?
The 'pygame' module does provide a mixer so that you can control the
volume of your own application:
so perhaps you might be able to do something with it.
Good luck to you!
More information about the Tutor