Advertisement
ozozx235

soundloop.lua

Mar 29th, 2021 (edited)
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.40 KB | None | 0 0
  1. spkr = peripheral.wrap("right")
  2. pit=0
  3. cng=1
  4. instrument = {"harp","bass","snare","hat","basedrum","flute","bell","chime","guitar", "xylophone", "iron_xylophone", "cow_bell", "didgeridoo", "bit", "banjo", "pling"}
  5. i=8
  6. while true do
  7. if pit==0 then
  8. cng=1
  9. i=(i+1)%16
  10. shell.run("clr")
  11. print(instrument[i+1])
  12. elseif pit==24 then
  13. cng=-1
  14. end
  15. spkr.playNote(instrument[i+1],15,pit)
  16. pit=pit+cng
  17. sleep(0.1)
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement