XEXModz

speakernode

Apr 25th, 2026 (edited)
50
0
Never
8
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. -- ===== Speaker Node v2 =====
  2. -- Auto-joins the music network. Plays whatever the main computer broadcasts.
  3. -- Setup: place computer + wireless modem + speaker adjacent. Save as startup.lua. Reboot.
  4.  
  5. local PROTOCOL = "atmop_music"
  6. local HOSTNAME = "speaker_" .. os.getComputerID()
  7.  
  8. -- Find wireless modem
  9. local modem
  10. for _, side in ipairs(peripheral.getNames()) do
  11. if peripheral.getType(side) == "modem" and peripheral.call(side, "isWireless") then
  12. modem = side
  13. break
  14. end
  15. end
  16. if not modem then error("No wireless modem attached") end
  17.  
  18. -- Find local speaker
  19. local speaker = peripheral.find("speaker")
  20. if not speaker then error("No speaker attached") end
  21.  
  22. rednet.open(modem)
  23. rednet.host(PROTOCOL, HOSTNAME)
  24.  
  25. term.clear()
  26. term.setCursorPos(1,1)
  27. print("Speaker Node Online")
  28. print("ID: " .. os.getComputerID())
  29. print("Listening on protocol: " .. PROTOCOL)
  30. print("Waiting for audio...")
  31.  
  32. local decoder = require("cc.audio.dfpwm").make_decoder()
  33. local audioQueue = {}
  34. local stopFlag = false
  35. local currentVolume = 1.5
  36.  
  37. -- Receiver: just stuffs incoming chunks into the queue
  38. local function receiverLoop()
  39. while true do
  40. local sender, msg = rednet.receive(PROTOCOL)
  41. if type(msg) == "table" then
  42. if msg.cmd == "audio" and msg.chunk then
  43. currentVolume = msg.volume or 1.5
  44. table.insert(audioQueue, msg.chunk)
  45. -- Cap queue size to prevent runaway memory
  46. if #audioQueue > 8 then
  47. table.remove(audioQueue, 1)
  48. end
  49. elseif msg.cmd == "stop" then
  50. stopFlag = true
  51. audioQueue = {}
  52. speaker.stop()
  53. elseif msg.cmd == "ping" then
  54. rednet.send(sender, {cmd="pong", id=os.getComputerID()}, PROTOCOL)
  55. end
  56. end
  57. end
  58. end
  59.  
  60. -- Player: pulls from queue and plays, yielding properly
  61. local function playerLoop()
  62. while true do
  63. if #audioQueue > 0 then
  64. stopFlag = false
  65. local chunk = table.remove(audioQueue, 1)
  66. local ok, buffer = pcall(decoder, chunk)
  67. if ok and buffer then
  68. local played = false
  69. while not played do
  70. if stopFlag then break end
  71. if speaker.playAudio(buffer, currentVolume) then
  72. played = true
  73. else
  74. -- Wait for buffer to drain, but with timeout fallback
  75. local timer = os.startTimer(2)
  76. while true do
  77. local ev, p1 = os.pullEvent()
  78. if ev == "speaker_audio_empty" then break end
  79. if ev == "timer" and p1 == timer then break end
  80. end
  81. end
  82. end
  83. end
  84. else
  85. os.sleep(0.05)
  86. end
  87. end
  88. end
  89.  
  90. parallel.waitForAny(receiverLoop, playerLoop)
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Tortalit
    16 days
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=vketxrsplw
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment