Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- speaker = peripheral.wrap("bottom")
- function mysplit (inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- table.insert(t, str)
- end
- return t
- end
- songName = read()
- Play = false --holdover from organ setup. could be more optimized for this
- --main code
- print("Playing song!")
- for line in io.lines(songName) do
- local msg = mysplit(line, ', ')
- if msg[2] == 'off' then
- Play = false
- elseif msg[2] == 'on' then
- Play = true
- end
- sleep(tonumber(msg[1]))
- speaker.playNote(msg[4],1,tonumber(msg[3]))
- end
- print("end of song!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement