Advertisement
visiongaming43

Untitled

May 29th, 2022
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. local speaker = peripheral.find("speaker")
  2.  
  3. local t, dt = 0, 2 * math.pi * 220 / 48000
  4. while true do
  5. local buffer = {}
  6. for i = 1, 16 * 1024 * 8 do
  7. buffer[i] = math.floor(math.sin(t) * 127)
  8. t = (t + dt) % (math.pi * 2)
  9. end
  10.  
  11. while not speaker.playAudio(buffer) do
  12. os.pullEvent("speaker_audio_empty")
  13. end
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement