osc-js is an Open Sound Control (OSC) library for JavaScript, supporting Node.js and browser environments via UMD module. Current stable version is 2.4.1 (released monthly). It provides address pattern matching, timetag handling, built-in UDP, WebSocket, and bridge plugins, and a customizable Plugin API. Key differentiators include zero dependencies (except ws for Node.js), TypeScript definitions, and support for all OSC 1.0 specifications plus extended argument types.
npm install osc-jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic setup: create OSC instance, listen for messages, send a message on open, and start listening on UDP port 9000.
Use `new OSC({ plugin: new OSC.DatagramPlugin() })` instead of `new OSC(OSC.DatagramPlugin())`Use standard timetag format: [seconds, fractional_seconds]
Assign listener once; avoid calling `osc.on('open', ...)` inside other callbacks.Wait for 'open' event before calling `osc.send()`.
Use `import OSC from 'osc-js'` instead of `import { OSC } from 'osc-js'`Run `npm install bufferutil` or set `npm config set optional false`
Start a WebSocket server (e.g., with OSC.WebsocketServerPlugin) on port 8080.