0.2.2 • Public • Published


A readable- and writable stream of OSC Messages, wrapping an underlying OSC Websocket client (from the @adzialocha/osc-js library).


Requires an OSC bridge server running on your local network, to enable bi-directional messaging between the OSCStream class instance and a remote OSC controller. You can use the @petitatelier/osc-bridge command-line utility to start one. See demo instructions hereafter.


  <script type="module">
    import { OSCStream , OSCMessageHTMLFormatter } from "@petitatelier/osc-stream";
    const oscStream = new OSCStream({ host: "", port: 8080 });

      .pipeThrough( OSCMessageHTMLFormatter)
      .pipeTo( streamingElement.writable)
      .catch( err => console.error( "Something went wrong!", err));

    const oscWriter = oscStream.writable.getWriter();
    oscWriter.write( new self.OSC.Message( "/ping"))
      .catch( err => console.error( "Something went wrong!", err));


Run following command and navigate to

$ npm run dev:osc


OSC bridge server

The npm run dev:osc command will start an OSC bridge server, along with the local dev HTTP server, enabling bi-directional messaging between a remote OSC controller and the OSCStream class instance of the demo.

Before starting the OSC bridge server, you might want to tweak its configuration; see the config section of the package.json at the root of this monorepo.

  "config": {
    "http-server": {
      "host": "",
      "port": "8081"
    "osc-bridge": {
      "udp-server": {
        "host": "",
        "port": "7400"
      "udp-client": {
        "host": "",
        "port": "7500"
      "ws-server": {
        "host": "",
        "port": "8080"

OSC remote controller

You will also need to configure your remote OSC controller app, to send its outgoing messages to the OSC bridge server.

Use the IP address of the network adapter listed by the OSC bridge server upon start. For instance, if you get following output, your computer and the OSC bridge server will be reachable at IP

$ npm run dev:osc

> @petitatelier/data-streams@ dev:osc …
> osc-bridge & npm run dev && fg

OSC Websocket <-> UDP bridge server
Bridging OSC over Web Socket to/from `ws://`
Listening for OSC over UDP on ``
Broadcasting OSC over UDP to ``
Local host reachable at: [ en0: `` ]

And if you were using the popular TouchOSC remote OSC controller app, you would consequently configure its Host and Port (outgoing) fields with IP and port 7400, as shown in screencopy hereafter:

TouchOSC configuration · Screencopy

Package Sidebar


DownloadsWeekly Downloads






Unpacked Size

12.2 kB

Total Files


Last publish


  • olange