npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dmx

v0.2.5

Published

A nodejs DMX library

Downloads

302

Readme

node-dmx

DMX-512 controller library for node.js

Install

npm install dmx

Library API

const DMX = require('dmx')

Class DMX

new DMX()

Create a new DMX instance. This class is used to tie multiple universes together.

dmx.registerDriver(name, module)

  • name - String
  • module - Object implementing the Driver API

Register a new DMX Driver module by its name. These drivers are currently registered by default:

  • null: a development driver that prints the universe to stdout
  • socketio: a driver which sends out the universe via socket.IO as an array (see demo_socket_client.js as a client example)
  • artnet: driver for EnttecODE
  • bbdmx: driver for BeagleBone-DMX
  • dmx4all: driver for DMX4ALL devices like the "NanoDMX USB Interface"
  • enttec-usb-dmx-pro: a driver for devices using a Enttec USB DMX Pro chip like the "DMXKing ultraDMX Micro".
  • enttec-open-usb-dmx: driver for "Enttec Open DMX USB". This device is NOT recommended, there are known hardware limitations and this driver is not very stable. (If possible better obtain a device with the "pro" chip)
  • dmxking-utra-dmx-pro: driver for the DMXKing Ultra DMX pro interface. This driver support multiple universe specify the options with Port = A or B

dmx.addUniverse(name, driver, device_id, options)

  • name - String
  • driver - String, referring a registered driver
  • device_id - Number or Object
  • options - Object, driver specific options

Add a new DMX Universe with a name, driver and an optional device_id used by the driver to identify the device. For enttec-usb-dmx-pro and enttec-open-usb-dmx device_id is the path the the serial device. For artnet it is the target ip.

dmx.update(universe, channels[, extraData])

  • universe - String, name of the universe
  • channels - Object, keys are channel numbers, values the values to set that channel to
  • extraData - Object, this data will be passed unmodified to the update Event. (Optional; default value is {})

Update one or multiple channels of a universe. Also emits a update Event with the same information.

DMX.devices

A JSON Object describing some Devices and how many channels they use. Currently not many devices are in there but more can be added to the devices.js file. Pull requests welcome ;-)

The following Devices are known:

  • generic - a one channel dimmer
  • showtec-multidim2 - 4 channel dimmer with 4A per channel
  • eurolite-led-bar - Led bar with 3 RGB color segments and some programms
  • stairville-led-par-56 - RGB LED Par Can with some programms

Class DMX.Animation

new DMX.Animation([options])

Create a new DMX Animation instance. This can be chained similar to jQuery.

The options Object takes the following keys:

  • loop - Number, the number of times this animation sequence will loop when run is invoked. This value is overridden if you invoke runLoop.
  • filter - Function, allows you to read or modify the values being set to each channel during each animation step.

If you specify a filter function, it must take a single object parameter in which keys are channel numbers and values are the values to set those channels to. You may modify the values in the object to override the values in real-time, for example to scale channel brightness based on a master fader.

animation.add(to, duration, options)

  • to - Object, keys are channel numbers, values the values to set that channel to
  • duration - Number, duration in ms
  • options - Object

Add an animation Step. The options Object takes an easing key which allows to set a easing function from the following list:

  • linear (default)
  • inQuad
  • outQuad
  • inOutQuad
  • inCubic
  • outCubic
  • inOutCubic
  • inQuart
  • outQuart
  • inOutQuart
  • inQuint
  • outQuint
  • inOutQuint
  • inSine
  • outSine
  • inOutSine
  • inExpo
  • outExpo
  • inOutExpo
  • inCirc
  • outCirc
  • inOutCirc
  • inElastic
  • outElastic
  • inOutElastic
  • inBack
  • outBack
  • inOutBack
  • inBounce
  • outBounce
  • inOutBounce

Returns a Animation object with the animation step added.

animation.delay(duration)

  • duration - Number, duration in ms

Delay the next animation step for duration. Returns a Animation object with the delay step added.

animation.run(universe, onFinish)

  • universe - Object, reference to the universe driver
  • onFinish - Function, called when the animation is done

Run the Animation on the specified universe.

animation.runLoop(universe)

  • universe - Object, reference to the universe driver

Runs an animation constantly until animation.stop() is called

The example below shows a value being animated for 5 seconds:

const animation = new DMX.Animation().add({
  1: 255,
}, 100).add({
  1: 0,
}, 100).runLoop(universe)


setTimeout(() => {
  animation.stop()
}, 5000)

update Event

  • universe - String, name of the universe
  • channels - Object, keys are channel numbers, values the values to set that channel to
  • extraData - Object, data that was passed to the update method.

This event is emitted whenever update is called either by the integrating application or by an animation step.

If triggered by an animation step, extraData.origin will be the string 'animation'.

Webinterface

Versions prior to 0.2 included a Webinterface. This has since been moved into its own repository at https://github.com/node-dmx/dmx-web

Community

We're happy to help. Chat with us on IRC in #node-dmx on freenode.