Sound.volume read/write property
Get or set the sound volume, a linear scale, with 0
results in silence and anything above 1
results in sound 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 sound volume")
print("Press SPACE to exit")
local sound = audio.Sound("music.mp3")
while true do
local c, special = console.readchar()
if special == true then
if c == "H" then -- UP key have been pressed
sound.volume = sound.volume + 0.1
print("Sound volume set to "..sound.volume)
elseif c == "J" then -- DOWN key have been pressed
sound.volume = sound.volume - 0.1
print("Sound volume set to "..sound.volume)
end
elseif c == " " then -- SPACE key have been pressed
print("Stop playing...")
break
end
end