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.
Sample code illustrating how to use osc.js in a variety of scenarios.
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.
Hey All, we would like to trigger sounds remotely from a Javascript webpage, without installing any software on the MacOS machine using the webpage in Chrome. We were thinking to use Ableton Live / MAX MSP on a Mac to receive the OSC message and play the sound. Is this doable with this library ?
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:
osc.js-examples/udp-browser/index.js
Line 55 in b1bc1aa
Relay() in source code:
https://github.com/colinbdclark/osc.js/blob/3bfa3d4489497b04a806298b1f502ffbbdfed2df/src/osc-transports.js#L133
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
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);
});
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.
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"
});
There have been changes in the nature of osc.js and some of its dependencies. These examples should updated accordingly.
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
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.
sorry im noob here. when i npm install in the downloaded browser folder it generates the following error. I tried to google that error and find solutions but im too noob to understand any of them. prebuild-install WARN install No prebuilt binaries found (target=10.13.0 runtime=node arch=x64 platform=darwin)
what should i do?
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
?
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,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.