Retrieves a volume setting of a sound device.

Setting := SoundGetVolume(Component, Device)



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 volume setting is retrieved.

For further details, see Component (Sound Functions).


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).

Return Value

Type: Float or String (empty)

This function returns a floating point number between 0.0 and 100.0.

Error Handling

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


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


Sound Functions



master_volume := SoundGetVolume()
MsgBox "Master volume is " master_volume " percent."

mic_volume := SoundGetVolume("Microphone")
MsgBox "Microphone listening volume is " mic_volume " percent."

mic_volume := SoundGetVolume( , "Microphone")
MsgBox "Microphone recording volume is " mic_volume " percent."