Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = peripheral.wrap('left')
- function playnote(s,channel,note, time)
- local f = 0
- elseif note == '4c' then f = 261.63
- elseif note == '4c#' then f = 277.18
- elseif note == '4d' then f = 293.66
- elseif note == '4d#' then f = 311.13
- elseif note == '4e' then f = 329.63
- elseif note == '4f' then f = 349.23
- elseif note == '4f#' then f = 369.99
- elseif note == '4g' then f = 392.00
- elseif note == '4g#' then f = 415.30
- elseif note == '4a' then f = 440.00
- elseif note == '4a#' then f = 466.16
- elseif note == '4b' then f = 493.88
- end
- print(f..' '..note)
- s.start(channel,f)
- sleep(time)
- end
- function playnotes(s,channel,notes,time)
- for i,j in pairs(notes) do
- playnote(s,channel,j,time)
- end
- end
- playnotes(s,1,{'d','d','d','d#','a#'},0.25)
- s.shutdown()
- print(s.shutdown())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement