Quickstart
Send a fade on universe 1 in a few lines.
Install the package and sacn, then create a Node source:
npm install @helioslx/core sacnimport { createSacnSource } from "@helioslx/core/node";
const source = createSacnSource({
name: "My lighting app",
transportOptions: {
// Required when the host has more than one network interface.
iface: "192.168.10.20",
},
});
const universe = source.universe(1, {
priority: 100,
sourceName: "Dimmers",
});
await universe.fadeChannels(
{
1: 255,
2: 128,
},
{ durationMs: 1_000 },
);That schedules a one-second fade on channels 1 and 2. The Node helper also
registers SIGINT / SIGTERM / beforeExit handlers that call close().
What just happened
createSacnSourcebuilds a source with an owned UDP transport.universe(1, …)returns a handle for universe 1 at priority 100.fadeChannelsvalidates the map, starts the scheduler if needed, persists the target, and begins sending frames.
Channels are one-based. Values are 0..255. Awaiting the call does not wait
for the fade to finish — only for the write to be accepted.
Useful follow-ups
Snap immediately:
await universe.setChannels({ 1: 255, 2: 128 });Different durations per channel:
await universe.transition([
{ channel: 1, value: 0, durationMs: 500 },
{ channel: 10, value: 255, durationMs: 2_000 },
]);Read current state:
const snapshot = await universe.get();
const outputs = await source.listUniverses();Clear an output:
await universe.clear();Next
- Sources and universes — addressing and handles
- Writing output — snaps, fades, and write semantics
- Networking — interfaces, multicast, firewalls
- Runnable quickstart — full example from the core repo