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 🙏

© 2026 – Pkg Stats / Ryan Hefner

serialosc

v1.0.0

Published

monome serialosc interface

Readme

node-serialosc

node-serialosc allows easy integration with monome grid and arc devices. You can install it via npm:

npm install serialosc

Simple Example

This example script will listen for devices and attach a key handler that sets the corresponding led:

var serialosc = require('serialosc');
serialosc.start();
serialosc.on('device:add', function (device) {
  device.on('key', function (data) {
    device.set(data);
  });
});

Configuration

You can pass configuration options to the start method:

serialosc.start({
  host: 'localhost',         // ip/hostname to listen on
  port: 4200,                // port to listen on (default = random port number)
  serialoscHost: 'locahost', // ip/hostname where serialosc is running
  serialoscPort: 12002,      // port where serialosc is running
  startDevices: true         // auto-start devices
});

If startDevices is set to false you will need to start the device manually and listen for the initialized event. This can be helpful if you want to run multiple applications but only initialize certain devices in each application. For example:

serialosc.start({
  startDevices: false
});
serialosc.on('m1000079:add', function (device) {
  device.start();
  device.on('initialized', function () {
    device.on('key', function (data) {
      device.set(data);
    });
  });
});

Events

You can listen for device:add or device:remove events

serialosc.on('device:add', function (device) {
});

serialosc.on('device:remove', function (device) {
});

You can also listen by device id:

serialosc.on('m1000079:add', function (device) {
});

serialosc.on('m1000079:remove', function (device) {
});

Devices

Devices are passed through device:add events. You can also access an array of devices at serialosc.devices

// an example device
{
  id: 'm40h0800',
  type: 'monome 40h',
  host: 'localhost',
  port: 14123,
  deviceHost: 'localhost',
  devicePort: 11109,
  connected: true
}

Grid Devices

Use device.on('key', callback) to listen for key press events. Press events are objects in the form:

{x: ..., y: ..., s: ...}:

Example:

device.on('key', function (press) {
  console.log(press); // {x: 1, y: 2, s: 1}
});

You can set the LEDs of a grid device using the following methods:

device.set(4, 6, 1);
// alternate set syntax
device.set({x: 4, y: 6, s: 1});
device.col(3, 0, 255);
device.row(0, 3, 255);
device.all(1);
device.map(0, 0, [
  255, 255, 255, 255, 255, 255, 255, 255
]);
// alternate map syntax
device.map(0, 0, [
  [0, 1, 0, 1, 0, 1, 0, 1],
  [1, 0, 1, 0, 1, 0, 1, 0],
  [0, 1, 0, 1, 0, 1, 0, 1],
  [1, 0, 1, 0, 1, 0, 1, 0],
  [0, 1, 0, 1, 0, 1, 0, 1],
  [1, 0, 1, 0, 1, 0, 1, 0],
  [0, 1, 0, 1, 0, 1, 0, 1],
  [1, 0, 1, 0, 1, 0, 1, 0]
]);

For varibright devices:

device.levelSet(4, 6, 15);
// alternate set syntax
device.levelSet({x: 4, y: 6, l: 15});
device.levelCol(3, 0, [0, 1, 2, 3, 4, 5, 6, 7]);
device.levelRow(0, 3, [0, 1, 2, 3, 4, 5, 6, 7]);
device.levelAll(15);
device.levelMap(0, 0, [
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15
]);

Arc Devices

Use device.on('key', callback) to listen for encoder press events. Press events are objects in the form:

{n: ..., s: ...}:

Example:

device.on('key', function (press) {
  console.log(press); // {n: 0, s: 1}
});

Use device.on('delta', callback) to listen for encoder delta events. Delta events are objects in the form:

{n: ..., d: ...}:

Example:

device.on('delta', function (delta) {
  console.log(delta); // {n: 0, d: -2}
});

You can set the LEDs of an arc device using the following methods:

device.set(0, 32, 15);
// alternate set syntax
device.set({n: 0, x: 32, l: 15});
device.range(0, 10, 20, 15);
device.all(0, 15);
device.map(0, [
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15,
  15, 15, 15, 15, 15, 15, 15, 15
]);