Advertisement
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()
- while 1 do
- local data = http.get(arg[1], nil , true)
- -- for
- local info = data
- filename = "data"
- while 1 do
- local cksize = 16*1024
- local chunk = data.read(cksize)
- local decoded = decoder(chunk)
- while not speaker.playAudio(decoded) do
- os.pullEvent("speaker_audio_empty")
- end
- if(string.len(chunk) < cksize ) then
- -- file.close()
- break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement