GithubHelp home page GithubHelp logo

colinbdclark / osc.js-examples Goto Github PK

View Code? Open in Web Editor NEW
104.0 8.0 28.0 72 KB

Sample code illustrating how to use osc.js in a variety of scenarios.

CSS 6.43% JavaScript 72.03% Python 3.10% HTML 12.57% SuperCollider 2.84% C++ 3.02%

osc.js-examples's Introduction

osc.js Examples

This repository contains examples of how to use osc.js in a variety of situations, including in a browser with Web Sockets, on Node.js, and in a Chrome App.

For more information, please see osc.js.

osc.js-examples's People

Contributors

colinbdclark avatar drart avatar jaschanarveson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osc.js-examples's Issues

Unsupported relay() methods in examples?

Looking through the examples, it seems that .Relay() is used. When debugging and building my app, I went to troubleshoot the Relay() method and the source code indicates that this is an Unsupported, non-API function..

My question/issue is: Should we be presenting unsupported functions in the official examples for OSC.js? If not, we should update this example.

Relay() in examples:

var relay = new osc.Relay(udp, socketPort, {

Relay() in source code:
https://github.com/colinbdclark/osc.js/blob/3bfa3d4489497b04a806298b1f502ffbbdfed2df/src/osc-transports.js#L133

[QUESTION] Is it possible to send Multicast OSC messages?

Hi all,
Thanks, this library is quite handy. I am working on sending OSC messages to multiple devices with different IPs and ports. I saw you have an example of listening from multiple hosts using UDPPort. How can use UDPPort to send several messages to different devices connected to the same network? Thanks

UDP broadcast example

Hi.

Do you have an example on how to broadcast with osc.UDPPort?

I tried to substitute the address with the network mask (255.255.0.0) and I tried to remove the address alltogheter with no luck.

var udpPort = new osc.UDPPort({
  localAddress: "0.0.0.0",
  localPort: 57121,
  metadata: true,
  broadcast: true
});

udpPort.open();

udpPort.on("ready", function () {
  udpPort.send({
    address: "/s_new",
    args: [
      {
        type: "s",
        value: "default"
      },
      {
        type: "i",
        value: 100
      }
    ]
  }, "255.255.0.0", 8050);
});

Can a HTTP Server and WebSocket Server share the same Port

Is this something that can be done, and increase efficiency or better to have to different ports for each? I am asking this here because when I am pressing my button that is bind with osc message sent function it sends the message after 3 clicks approximatelly, so I am wondering if this is because the websocket server uses a different port number.

osc.WebSocket connection failed from other endpoint in the same network

I am following this example in my app running using Express and WebSockets to establish bi-directional communication with browser <-> server <-> supercollider and works fine when my endpoint(s) are on the same computer. Still, I am trying to access the app from a remote computer in the same network using the host's remote IP 192.168.1.102:8081 when opening a browser window but it returns this message: WebSocket connection to ws://localhost:8081 failed osc-browser.min.js:813

When I am omitting the IP in the client code with 192.168.1.102 (host IP) it works just fine.

//server.js
var udpPort = new osc.UDPPort({
    localAddress: "0.0.0.0",
    localPort: 57121,
    remoteAddress: "127.0.0.1",
    remotePort: 57120
});

const wss = new WebSocket.Server({
    port:8081
});

wss.on("connection", function (socket) {
    console.log("A Web Socket connection has been established!");
    var socketPort = new osc.WebSocketPort({
        socket: socket
    });
    /*relaying from socketport to udp,
      server hits back OSC from SC to browser
      [Browser(WBsocks) <--> UDP <--> SC]*/
    var relay = new osc.Relay(udpPort, socketPort, {
        raw: true
    });
});

//index.js
var oscPort = new osc.WebSocketPort({
  url: "ws://192.168.1.102:8081"
});

But that means I will always need to get the host's remote IP and omit it in my code, not ideal but it works this way.

A question might be worthy of squeezing it here, I am not sure this is covered but is it possible to bind osc.WebSocket Port in the same Port of the app, that is express app accessed on 8000? T

Tried some ways to do that but it won't work, some examples might come in handy. Something like this doesn't work at this point:


//server.js
var osc = require('osc'),
    WebSocket = require('ws');

let server = httpServer.listen(8000, () => {
    console.info(`App listening on port ${8000}`)
})

const wss = new WebSocket.Server({
    server: server
});

wss.on("connection", function (socket) {
    console.log("A Web Socket connection has been established!");
    var socketPort = new osc.WebSocketPort({
        socket: socket
    });
    /*relaying from socketport to udp,
      server hits back OSC from SC to browser
      [Browser(WBsocks) <--> UDP <--> SC]*/
    var relay = new osc.Relay(udpPort, socketPort, {
        raw: true
    });
});

//Index.js
var oscPort = new osc.WebSocketPort({
  url: "ws://localhost:8000"
});

install fails on serial dependency

HI ---

tried to global install OSC via npm on rPi.
rPI 3.0
Node version v6.10.2

Get this error:
pi@raspberrypi:~ $ sudo npm install osc -g

[email protected] install /usr/local/lib/node_modules/osc/node_modules/serialport
node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp)

The ARM version of serial for this release (4.0.7) does not exist.

thots?

steve

Unable to run the browser version

Missing script start error in electron. Newbie for electron can you just explain steps in detail. Unable to run the electron examples on Windows platform.

Installing osc without the serialport module

I have an OSC project that has been running inside NW.js on my Mac for quite a while. Now, I need to port it to Linux and I just cannot get it to work properly. I always get stuck on a serialport-related error.

I should mention that native libraries need to be specifically recompiled in order to work inside NW.js. I successfully did that a few years ago when the project started (on macOS) but I am unable to do it now.

This is the error I'm getting:

/home/jpcote/.cache/node-gyp/13.5.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
bindings.target.mk:112: recipe for target 'Release/obj.target/bindings/src/serialport.o' failed
make: *** [Release/obj.target/bindings/src/serialport.o] Error 1
make: Leaving directory '/home/jpcote/test2/node_modules/osc/node_modules/@serialport/bindings/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:305:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.0.0-37-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/jpcote/test2/node_modules/osc/node_modules/@serialport/bindings
gyp ERR! node -v v13.5.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 

Since I am using OSC over WebSockets, is it possible to install osc without having to install serialport ?

Running nodejs serial example and Arduino sketch not working

Hi there,
Uploaded the Arduino sketch in utils/ on a Teensy 3.2.
Only looking to get SLIP serial working with the Teensy, so commented-out the UDP portion of the code in nodejs/index.js, ran it (with my correct serial port), and the node process simply quits, no output.
Node version v5.10.1.
Using the CNMAT/OSC Arduino lib.

So I'm curious if anyone has recently tested that serial works by itself like this?
Perhaps I'm missing something obvious.
Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.