Advertisement
Guest User

test2

a guest
Sep 21st, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. s = peripheral.wrap('left')
  2. function playnote(s,channel,note, time)
  3.   local f = 0
  4.   elseif note == '4c' then f = 261.63
  5.   elseif note == '4c#' then f = 277.18
  6.   elseif note == '4d' then f = 293.66
  7.   elseif note == '4d#' then f = 311.13
  8.   elseif note == '4e' then f = 329.63
  9.   elseif note == '4f' then f = 349.23
  10.   elseif note == '4f#' then f = 369.99
  11.   elseif note == '4g' then f = 392.00
  12.   elseif note == '4g#' then f = 415.30
  13.   elseif note == '4a' then f = 440.00
  14.   elseif note == '4a#' then f = 466.16
  15.   elseif note == '4b' then f = 493.88
  16.  
  17.   end
  18.   print(f..' '..note)
  19.   s.start(channel,f)
  20.   sleep(time)
  21. end
  22.  
  23. function playnotes(s,channel,notes,time)
  24.   for i,j in pairs(notes) do
  25.     playnote(s,channel,j,time)
  26.   end
  27. end
  28. playnotes(s,1,{'d','d','d','d#','a#'},0.25)
  29. s.shutdown()
  30. print(s.shutdown())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement