guitarplayer616

play

May 13th, 2022 (edited)
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.31 KB | None | 0 0
  1. local dfpwm = require("cc.audio.dfpwm")
  2. local speaker = peripheral.find("speaker")
  3.  
  4. local decoder = dfpwm.make_decoder()
  5. for chunk in io.lines("data/example.dfpwm", 16 * 1024) do
  6.     local buffer = decoder(chunk)
  7.  
  8.     while not speaker.playAudio(buffer) do
  9.         os.pullEvent("speaker_audio_empty")
  10.     end
  11. end
Add Comment
Please, Sign In to add comment