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

node-osc

v11.2.2

Published

pyOSC inspired library for sending and receiving OSC messages

Readme

node-osc

A no frills Open Sound Control client and server. Heavily inspired by pyOSC.

Installation

Install using npm

npm install node-osc

Features

  • 🚀 Simple and intuitive API
  • 🔄 Both callback and async/await support
  • 📦 Send and receive OSC messages and bundles
  • 🌐 Works with both ESM and CommonJS
  • 📘 TypeScript type definitions included (generated from JSDoc)
  • 📝 Comprehensive documentation and examples
  • ✅ Well tested and actively maintained

Quick Start

Sending Messages

import { Client } from 'node-osc';

const client = new Client('127.0.0.1', 3333);
await client.send('/oscAddress', 200);
await client.close();

Receiving Messages

import { Server } from 'node-osc';

const server = new Server(3333, '0.0.0.0');

server.on('message', (msg) => {
  console.log(`Message: ${msg}`);
});

Documentation

  • 📂 Documentation Hub - Complete documentation with navigation guide
  • 📚 API Reference - Complete API reference generated from source code
  • 📘 Usage Guide - Best practices, error handling, and troubleshooting
  • 📖 Examples - Working examples for various use cases

Compatibility

Written using ESM, supports CJS.

Supports the latest versions of Node.js 20, 22, and 24 in both ESM + CJS.

TypeScript

TypeScript type definitions are included! No need to install @types/node-osc.

The types are automatically generated from JSDoc comments during the build process and included with the package. A single .d.mts type definition format is provided that works for both ESM and CommonJS consumers.

Note: If you previously installed @types/node-osc, you should uninstall it to avoid conflicts:

npm uninstall @types/node-osc

More Examples

Sending with async/await

import { Client } from 'node-osc';

const client = new Client('127.0.0.1', 3333);
await client.send('/oscAddress', 200);
await client.close();

Sending with callbacks

import { Client } from 'node-osc';

const client = new Client('127.0.0.1', 3333);
client.send('/oscAddress', 200, () => {
  client.close();
});

Listening for OSC messages

import { Server } from 'node-osc';

const oscServer = new Server(3333, '0.0.0.0', () => {
  console.log('OSC Server is listening');
});

oscServer.on('message', function (msg) {
  console.log(`Message: ${msg}`);
});

Sending OSC bundles

import { Bundle, Client } from 'node-osc';

const bundle = new Bundle(['/one', 1], ['/two', 2], ['/three', 3]);
const client = new Client('127.0.0.1', 3333);
await client.send(bundle);
await client.close();

Listening for OSC bundles

import { Server } from 'node-osc';

const oscServer = new Server(3333, '0.0.0.0', () => {
  console.log('OSC Server is listening');
});

oscServer.on('bundle', function (bundle) {
  bundle.elements.forEach((element) => {
    console.log(`Timestamp: ${bundle.timetag}`);
    console.log(`Message: ${element}`);
  });
});

Low-Level Encoding and Decoding

For advanced use cases, you can directly encode and decode OSC messages:

import { Message, encode, decode } from 'node-osc';

// Encode a message to binary
const message = new Message('/oscillator/frequency', 440);
const buffer = encode(message);

// Decode binary data back to a message
const decoded = decode(buffer);
console.log('Address:', decoded.address);
console.log('Value:', decoded.args[0].value);

This is useful for:

  • Sending OSC over non-UDP transports (WebSocket, TCP, HTTP)
  • Storing OSC messages to files or databases
  • Testing and debugging OSC implementations
  • Building custom OSC routers or processors

See the API Documentation for complete details.

CommonJS

Both callback and promise-based APIs work with CommonJS!

const { Client, Server } = require('node-osc');

async function main() {
  const server = new Server(3333, '0.0.0.0');
  const client = new Client('127.0.0.1', 3333);

  await new Promise((resolve) => {
    server.on('listening', resolve);
  });

  server.on('message', (msg) => {
    console.log(`Message: ${msg}`);
  });

  await client.send('/hello', 'world');
  await client.close();
  await server.close();
}

main();

Examples

See the examples directory for more usage examples:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Apache-2.0

Note: This project was relicensed from LGPL-3.0-or-later to Apache-2.0 in December 2025.