Skip to content

Instantly share code, notes, and snippets.

@oligriffiths
Last active May 22, 2024 15:19
Show Gist options
  • Save oligriffiths/3c10fd865322b759245ca6383506c310 to your computer and use it in GitHub Desktop.
Save oligriffiths/3c10fd865322b759245ca6383506c310 to your computer and use it in GitHub Desktop.
QLC Artnet Tester
/**
* Setup: yarn add artnet-protocol
* Make sure no other Artnet programs are running on your machine, check this with sudo lsof -i udp:6454 nothing should show
*
* QLC+: Enable ArtNet input on 127.0.0.1
* Create a slider in virtual console
* Hit auto detect
* Run this script, it should auto populate input universe and channel
* Now hit the Play icon in top right of QLC+
* Run this script and each run should move the slider to a new location
*
* Pro tip: Try using https://www.wireshark.org/ to monitor the local lo0 loopback address to see the packets.
* Filter to artnet.
*/
import dgram from "dgram";
import { protocol } from 'artnet-protocol';
const socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
const packet = new protocol.ArtDmx(0, 0, 0, [Math.round(Math.random() * 255)]);
const buffer = packet.encode();
socket.send(buffer, 0, buffer.length, 6454, '127.0.0.1');
console.log(`Sent ${packet.data[0]}`);
setTimeout(() => socket.close(), 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment