Type Function Library audio.* Return value Number Revision Release 2024.3703 Keywords audio, volume See also audio.setVolume()
Gets the volume for a specific channel, or gets the master volume.
This function returns:
{ channel=0 }
is specified.Note that the master volume is not necessarily the device's ringer volume. However, all volumes are scaled proportionally to the ringer volume.
audio.getVolume( { channel=c } )
Number. The channel number you want to get the volume on. Valid channels are 1
to the maximum number of channels (currently 32). Specifying 0
will return the average volume across all channels. Omitting this parameter entirely gets the master volume which is different than the channel volume. All channel volumes are scaled by the master volume.
local masterVolume = audio.getVolume() -- get the master volume local channel1Volume = audio.getVolume( { channel=1 } ) -- get the volume on channel 1