Nonsense Parser Microframework
    Wondering what’s next for npm?Check out our public roadmap! »

    node-osc

    5.2.3 • Public • Published

    node-osc

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

    Install using npm

    npm install node-osc
    

    Written using ESM supports CJS

    If you are using Node.js 10+ you can use this library.

    Example

    Sending OSC messages:

    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';
    
    var oscServer = new Server(3333, '0.0.0.0', () => {
      console.log('OSC Server is listening');
    });
    
    oscServer.on('message', function (msg) {
      console.log(`Message: ${msg}`);
      oscServer.close();
    });

    CJS API

    This just works due to conditional exports, isn't that cool!

    const { Client, Server } = require('node-osc');
    
    const client = new Client('127.0.0.1', 3333);
    var server = new Server(3333, '0.0.0.0');
    
    server.on('listening', () => {
      console.log('OSC Server is listening.);
    })
    
    server.on('message', (msg) => {
      console.log(`Message: ${msg}`);
      server.close();
    });
    
    client.send('/hello', 'world', (err) => {
      if (err) console.error(err);
      client.close();
    });

    License

    LGPL. Please see the file lesser.txt for details.

    Keywords

    Install

    npm i node-osc

    DownloadsWeekly Downloads

    275

    Version

    5.2.3

    License

    LGPL-2.1

    Unpacked Size

    76.2 kB

    Total Files

    36

    Last publish

    Collaborators

    • avatar