jeffreykog / node-artnet-protocol

ArtNet library for Node.js
MIT License
9 stars 3 forks source link

Node ArtNet Protocol

GitHub release npm License

ArtNet protocol implementation in Nodejs. The goal is to make a protocol implementation that is as complete and usable as possible. Use-cases for this library are virtual ArtNet clients such as ArtNet Hue Entertainment, or full ArtNet/DMX controllers.

Features

Usage

Install Node ArtNet Protocol using NPM:

$ npm install --save artnet-protocol

Code usage:

import { ArtNetController } from 'artnet-protocol/dist';
import { ArtDmx } from 'artnet-protocol/dist/protocol';

const controller = new ArtNetController();
controller.bind('0.0.0.0');
// The controller is now listening and responding to discovery traffic

// Send DMX data (Sequence 0, Physical input port 0, Universe 0.
controller.sendBroadcastPacket(new ArtDmx(0, 0, 0, [255, 0, 0]));

// Or if you want to receive DMX data
controller.on('dmx', (dmx) => {
    // dmx contains an ArtDmx object
    console.log(dmx.universe, dmx.data);
});

Reference