summaryrefslogtreecommitdiff
path: root/radio.lua
blob: c8ea9e85fcf7b34d180def60ae04ea032da0a5b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local channel = 8888


local radio = peripheral.find"radio_tower"
local speaker = peripheral.find"speaker"
assert(radio and speaker, "aaa")

radio.setFrequency(channel)

local channel_format = string.rep("b",48000)
while true do
	local _,_,data = os.pullEvent"radio_message"
	assert(#data == 48000,"weird format")
	speaker.playAudio({string.unpack(channel_format,data)})
end