Skip to content

Instantly share code, notes, and snippets.

@drucifer-sc
Last active August 19, 2025 10:49
Show Gist options
  • Select an option

  • Save drucifer-sc/3504e7d3c4495bcdccd104725fc6e68b to your computer and use it in GitHub Desktop.

Select an option

Save drucifer-sc/3504e7d3c4495bcdccd104725fc6e68b to your computer and use it in GitHub Desktop.
A minimal code example to tune a PASC channel and begin playback, no buffering mechanism, reliant on uniformly timed packets
--Example PASC tuner, minimal code to start listening; usage: exampleTunerPASC [channel_number] (eg: exampleTunerPASC 1337)
local modem=peripheral.find("modem",function(n,v)return v.isWireless()end)
local speaker_left=peripheral.wrap("left")
local speaker_right=peripheral.wrap("right")
if not modem then error("No wireless modem found.",3) end
local args={...} --Capture arguments
local chan=args[1] and tonumber(args[1]) or nil
if type(chan)=="number" then
modem.open(chan) --Open channel
while true do --Playback loop
local event={os.pullEvent()}
if event[1]=="modem_message" then
if event[3]==chan and event[4]==759 then
local payload=event[5]
speaker_left.playAudio(payload.buffer[1]) speaker_right.playAudio(payload.buffer[2])
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment