Connecting node.JS file with RNBO inside a raspberryPi
Hi everyone,
I’m trying to create a standalone RNBO program that uses the moon phase as a parameter to control various elements inside my patch.
I set up a Node.js script on a Raspberry Pi that outputs a value (Illum parameter) based on the moon phase.
On my computer, the RNBO program reads this parameter without any issues. However, when I run the same setup on the Raspberry Pi, RNBO does not seem to receive or respond to the parameter at all.
I’m not sure where the problem is coming from.
Has anyone experienced something similar or knows what I might be missing?
Any help would be greatly appreciated!
Here is the Node.js Code.
// note-test.js
const osc = require("osc");
const udpPort = new osc.UDPPort({
localAddress: "0.0.0.0",
localPort: 0, // safe local port
remoteAddress: "127.0.0.1",
remotePort: 57120 // Max will listen here
});
udpPort.open();
function moonPhase() {
const lunarPeriod = 29.530588; // days
const referenceNewMoon = new Date("2000-01-06T18:14:00Z");
const now = new Date();
const daysSince =
(now.getTime() - referenceNewMoon.getTime()) / (1000 60 60 * 24);
const phase = (daysSince % lunarPeriod) / lunarPeriod; // 0–1
const illumination = 0.5 (1 - Math.cos(2 Math.PI * phase));
return { phase, illumination };
}
udpPort.on("ready", () => {
setInterval(() => {
const m = moonPhase();
console.log("phase:", m.phase, "illum:", m.illumination);
udpPort.send({
address: "/moon",
args: [{ type: "f", value: m.phase },
{ type: "f", value: m.illumination }
]
});
}, 1000);
});
the runner uses 1234 as its OSC udp port. when you're running on the PI, have you tried that instead of 57120 ?