ThatGravyBoat

Untitled

Jan 31st, 2022 (edited)
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 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.  
  6. string.startswith = function(self, str)
  7. return self:find('^' .. str) ~= nil
  8. end
  9.  
  10. while true do
  11. id, message = rednet.receive()
  12.  
  13. if message:startswith("play_song") then
  14. while not speaker.playAudio(string.sub(message, 9, string.len(message))) do
  15. os.pullEvent("speaker_audio_empty")
  16. end
  17. end
  18. end
  19.  
Add Comment
Please, Sign In to add comment