Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dfpwm = require("cc.audio.dfpwm")
- local speaker = peripheral.find("speaker")
- local decoder = dfpwm.make_decoder()
- string.startswith = function(self, str)
- return self:find('^' .. str) ~= nil
- end
- while true do
- id, message = rednet.receive()
- if message:startswith("play_song") then
- while not speaker.playAudio(string.sub(message, 9, string.len(message))) do
- os.pullEvent("speaker_audio_empty")
- end
- end
- end
Add Comment
Please, Sign In to add comment