Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-14-2004, 12:32 PM   #1
Registered: Mar 2004
Location: NY
Distribution: Gentoo
Posts: 112

Rep: Reputation: 15
Script to Mute Windows' Volume

I want to write something that will mute the sound (on a Windows machine) after a certain period of time, either pre-set or user-defined. Basically it will work as a sleep timer. I am pretty familiar with Python, but not too much else. So I would prefer to use Python. I couldn't find any modules in the docs, however, that would allow this type of interfacing with Windows' audio control.

Any suggestions on how to do this would be good. Or if you know of an mp3 playing program that has 'sleep timer' functionality built in, let me know. Thanks.
Old 12-14-2004, 05:30 PM   #2
Registered: Jun 2003
Distribution: Gentoo and Ubuntu
Posts: 95

Rep: Reputation: 15
I'm not aware of any "easy" way to truly mute the device. However, following is a script with will set the volume for the windows Wave device to 0, which for me will essentially "mute" the audio output. To use the below script, just call the Mute() function with either True or False. You will also need to have tkSnack installed. It is available here. If anyone else has any better methods as to acheiving this goal, I'd be very interested to see them. Also, I believe pyGame has got some sound functions, but I did not look at them indepth.

import Tkinter
import tkSnack

root = Tkinter.Tk()

def Mute(boolean):
    global original
    if boolean is True:
        original =
        print "the original before mute is:", original
    elif boolean is False:
        g = globals()
        if ( == 0) and (g.has_key('orignal')):
        elif == 0:
Below is a small driver program:
import mute

quit = 0
while quit == 0:
    print "(1) Mute Sound"
    print "(2) Unmute Sound"
    print "(3) Quit"
    choice = input("Choice: ")

    if choice == 1:
    elif choice == 2:
    elif choice == 3:
        print "You have made an invalid selection"

Last edited by Dodgeram01; 12-14-2004 at 06:31 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mute/volume buttons to work? microsoft/linux Linux - Laptop and Netbook 7 08-20-2005 02:35 PM
Dell Inspiron 9200 Volume, Play, Mute Quick Buttons and Sound with Suse 9.3 elliotfuller Linux - Hardware 1 06-08-2005 10:38 PM
Volume Up/Down/Mute keys not working Blargity Linux - Laptop and Netbook 10 06-02-2005 10:56 AM
How to add another drive volume to Windows? mrgrieves General 4 04-25-2004 11:37 AM
Setting volume in a startup script Twigathy Mandriva 3 08-25-2003 07:25 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration