SoundSetMute

Changes a mute setting of a sound device.

SoundSetMute NewSetting , Component, Device

Parameters

NewSetting

Type: Number or String

Any positive number will turn on the setting (mute) and a zero will turn it off (unmute). However, if the number begins with a plus or minus sign, the setting will be toggled (set to the opposite of its current state).

Component

Type: String or Integer

The component's display name and/or index. For example, 1, "Line in" or "Line in:2".

If omitted or blank, the master mute setting is changed.

For further details, see Component (Sound Functions).

Device

Type: String or Integer

The device's display name and/or index. For example, 1, "Speakers", "Speakers:2" or "Speakers (Example HD Audio)".

If this parameter is omitted, it defaults to the system's default device for playback (which is not necessarily device 1).

For further details, see Device (Sound Functions).

Error Handling

An exception is thrown on failure. The exception's Message property may contain one of the following:

Remarks

An alternative way to toggle the master mute setting of the default playback device is to have the script send a keystroke, such as in the example below:

Send "{Volume_Mute}"  ; Mute/unmute the master volume.

To discover the capabilities of the sound devices installed on the system -- such as the names and available components -- run the soundcard analysis script.

Use SoundGetMute to retrieve the current mute setting.

Related

Sound Functions

Examples

#1: Basic examples

SoundSetMute true  ; Set master mute (on)
SoundSetMute -1  ; Toggle the master mute (set it to the opposite state)
SoundSetMute 1, "Line In"  ; Mute Line In
SoundSetMute 1, , "Microphone"  ; Mute microphone recording