Advertisement
Doob

beeeep

Apr 22nd, 2016
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. local note = require('note')
  2. local computer = require('computer')
  3. local event = require('event')
  4.  
  5. local oct = {
  6.   [44] = 'C',
  7.   [31] = 'C#',
  8.   [45] = 'D',
  9.   [32] = 'D#',
  10.   [46] = 'E',
  11.   [47] = 'F',
  12.   [34] = 'F#',
  13.   [48] = 'G',
  14.   [35] = 'G#',
  15.   [49] = 'A',
  16.   [50] = 'B'
  17. }
  18.  
  19. local set, e = 4
  20.  
  21. print([[
  22. C C# D D# E F F# G G# A B
  23. Z S  X D  C V G  B H  N M
  24. ]])
  25.  
  26. while 1 do
  27.   e = {event.pull('key_down')}
  28.   if e[4] > 2 and e[4] < 7 then
  29.     set = e[4]-1
  30.   else
  31.     if oct[e[4]] then
  32.       computer.beep(note.freq(oct[e[4]]..set), 0.1)
  33.     end
  34.   end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement