audio.volume read/write property
Get or set the global master volume, a linear scale, with 0
results in silence and anything above 1
results in amplification.
This property default value is set to 1.0
Example
local audio = require "audio"
local console = require "console"
print("Playing some music")
print("Press UP and DOWN arrow keys to change volume")
print("Press SPACE to exit")
audio.play("music.mp3")
while true do
local c, special = console.readchar()
if special == true then
if c == "H" then -- UP key have been pressed
audio.volume = audio.volume + 0.5
print("Audio volume set to "..audio.volume)
elseif c == "J" then -- DOWN key have been pressed
audio.volume = audio.volume - 0.5
print("Audio volume set to "..audio.volume)
end
elseif c == " " then -- SPACE key have been pressed
print("Stop playing...")
break
end
end