osmarks

Untitled

Jan 13th, 2023
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.24 KB | None | 0 0
  1. local speaker = peripheral.find("speaker")
  2.  
  3. local buffer = {}
  4. local t, dt = 0, 2 * math.pi * 220 / 48000
  5. for i = 1, 128 * 1024 do
  6.     buffer[i] = math.floor(math.sin(t) * 127)
  7.     t = (t + dt) % (math.pi * 2)
  8. end
  9.  
  10. speaker.playAudio(buffer)
Add Comment
Please, Sign In to add comment