InfOS/Libraries/sound/play-tune.lua
Gabriel Moreira Minossi c9fc3a1456 Improving play-tune
Improving readability and possibly performance
Using the notes api
2021-01-08 16:29:12 -03:00

16 lines
294 B
Lua

-- Import section
Computer = require("computer")
local note = require("note")
--
local function playTune(tune)
return function()
for i, tone in ipairs(tune) do
note.play(tone.pitch or tone, tone.duration or 0.1)
os.sleep(tone.wait or 0.01)
end
end
end
return playTune