How to use the node-osc.Client function in node-osc

To help you get started, we’ve selected a few node-osc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stimulant / ampm / model / network.js View on Github external
}

        //// Set up OSC connection from app.
        this.transports.oscFromApp = new osc.Server(this.get('oscFromAppPort'));

        // handle straight messages
        this.transports.oscFromApp.on('message', _.bind(function(message, info) {
            // handle bundles
            if (message[0] == '#bundle')
                this._handleOsc(this.transports.oscFromApp, message[2], info);
            else
                this._handleOsc(this.transports.oscFromApp, message, info);
        }, this));

        //// Set up OSC connection to app.
        this.transports.oscToApp = new osc.Client('127.0.0.1', this.get('oscToAppPort'));

        //// Set up socket connection to app.
        this.transports.socketToApp = ioServer.listen(this.get('socketToAppPort'));
    },
github kn0ll / osc.io / lib / osc.io.js View on Github external
function client_channel_handler(socket) {
  var ns = socket.namespace.name,
    port = parse_io_ns_option(ns),
    osc_client = new osc.Client('127.0.0.1', port);

  // proxy osc messages from udp to socket.io
  // expects 'message' in form of [path, value]
  // ie. ['/osc/test', 200]
  socket.on('message', function(message) {
    osc_client.send(message[0], message[1]);
  });

  // expose a method to modify the client host. see readme.
  // at the moment, this just creates a whole new
  // client rather than configuring the host
  // of the existing client.
  socket.on('set-host', function(host) {
    osc_client = new osc.Client(host, port);
  });
}
github termie / node-osc / examples / client.js View on Github external
var osc = require('node-osc');

var client = new osc.Client('127.0.0.1', 3333);
client.send('/oscAddress', 1, 1, 2, 3, 5, 8);

// or
// var msg =  new osc.Message('/address')
// msg.append("testing");
// msg.append("testing");
// msg.append(123);
// client.send(msg)

// or
// var msg = new osc.Message('/address', 1, 2, 3);
// client.send(msg);
github AravinthPanch / gesture-recognition-for-human-robot-interaction / source / control-center / utils / osc / server.js View on Github external
'use strict';

/**
 * Author: Aravinth Panchadcharam
 * Email: me@aravinth.info
 * Date: 17/06/15.
 * Contributors:
 */


var osc = require('node-osc');

var client = new osc.Client('127.0.0.1', 5000);

var classLabel = 2;

var data = require('../../../../data/test/json/' + classLabel + '.js');

var i = 0;

setInterval(function () {

	if ('RIGHT' in data.handData[i] && 'LEFT' in data.handData[i]) {
		var left = data.handData[i].LEFT.map(Number);
		var right = data.handData[i].RIGHT.map(Number);
		var output = left.concat(right);

		client.send('/Data', output, function () {
			console.log(output)
github stagas / node-supercollider / supercollider.js View on Github external
SuperCollider.prototype._createClient = function(port, rr, host) {
  console.log(port, rr, host)
  return new osc.Client(port, rr, host, true)
}
github j4cbo / j4cDAC / abstrax / ui / server.js View on Github external
* along with this program.  If not, see .
 */

var static = require('node-static')
  , http = require('http')
  , osc = require('node-osc')
  , fs = require('fs')
  , socketio = require('socket.io');
 
var ip = '255.255.255.255';
if (process.argv[2]) {
    ip = process.argv[2];
}
console.log(ip);

var oscClient1 = new osc.Client(ip, 60000);
var oscClient2 = new osc.Client('127.0.0.1', 60000);
oscClient2._sock.bind();
oscClient2._sock.setBroadcast(true);

var state = {};


function dump() {
    var kvpairs = [];
    for (var k in state) {
        kvpairs.push(k + ":" + state[k]);
    }
    return kvpairs.join(" ");
}

function updateState(msg) {
github hundredrabbits / Orca / desktop / sources / scripts / core / io / osc.js View on Github external
this.setup = function () {
    if (!this.port) { return }
    if (this.socket) { this.socket.close() }
    this.socket = new osc.Client(client.io.ip, this.port)
    console.info('OSC', `Started socket at ${client.io.ip}:${this.port}`)
  }
}
github MAKIO135 / aioi / desktop / src / scripts / osc.js View on Github external
    const updateClient = (index, ip, port) =>  clients.splice(index, 1, new osc.Client(ip, port))
github MAKIO135 / aioi / desktop / js / clients.js View on Github external
constructor(host) {
            Object.keys(host).forEach(key => this[key] = host[key]);
            
            if (this.type === 'udp') {
                this.client = udpClient;
            }
            else {
                this.client = new osc.Client(this.ip, this.port);
            }
        }
github kn0ll / osc.io / lib / osc.io.js View on Github external
socket.on('set-host', function(host) {
    osc_client = new osc.Client(host, port);
  });
}

node-osc

pyOSC inspired library for sending and receiving OSC messages

LGPL-3.0
Latest version published 2 months ago

Package Health Score

79 / 100
Full package analysis