arismoko

Piano 2

Sep 25th, 2021 (edited)
3,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("ari's piano - use qwerty to play (:")
  2. speaker = peripheral.find("speaker")
  3. while true do
  4.   local event, key, isHeld = os.pullEvent("key")
  5.  
  6.   if key == keys.q then
  7.       print ("G")
  8.       speaker.playSound("minecraft:block.note_block.harp",2,.53)
  9.       elseif key == keys.two then
  10.       print ("G#")
  11.       speaker.playSound("minecraft:block.note_block.harp",2,.572)
  12.       elseif key == keys.w then
  13.       print ("A")
  14.       speaker.playSound("minecraft:block.note_block.harp",2,.595)
  15.       elseif key == keys.three then
  16.       print ("A#")
  17.       speaker.playSound("minecraft:block.note_block.harp",2,.63)
  18.       elseif key == keys.e then
  19.       print ("B")
  20.       speaker.playSound("minecraft:block.note_block.harp",2,.67)
  21.       elseif key == keys.r then
  22.       print ("C")
  23.       speaker.playSound("minecraft:block.note_block.harp",2,.71)
  24.       elseif key == keys.five then
  25.       print ("C#")
  26.       speaker.playSound("minecraft:block.note_block.harp",2,.75)
  27.       elseif key == keys.t then
  28.       print ("D")
  29.       speaker.playSound("minecraft:block.note_block.harp",2,.795)
  30.       elseif key == keys.six then
  31.       print ("D#")
  32.       speaker.playSound("minecraft:block.note_block.harp",2,.84)
  33.       elseif key == keys.y then
  34.       print ("E")
  35.       speaker.playSound("minecraft:block.note_block.harp",2,.89)
  36.       elseif key == keys.u then
  37.       print ("F")
  38.       speaker.playSound("minecraft:block.note_block.harp",2,.945)
  39.       elseif key == keys.i then
  40.       print ("F#")
  41.       speaker.playSound("minecraft:block.note_block.harp",2,1.0625)
  42.  
  43. end
  44. end
Add Comment
Please, Sign In to add comment