GithubHelp home page GithubHelp logo

oscxyz's Introduction

TouchOSC Accelerometer Data to p5js

Description

oscxyz is a simple OSC-to-WebSockets bridge that takes OSC messages from a client, like TouchOSC, and sends them to a WebSocket client, like a p5js sketch.

Note that this implementation is very basic and was created specifically to handle accelerometer data with an OSC type tag of ",fff" and an address pattern of "/accxyz" (although the address pattern can be changed with the --pattern flag).

See also my oscdump utility

Sequence Diagram

sequenceDiagram
TouchOSC-->>oscxyz: TCP connection 
p5.js-->>oscxyz: WebSockets connection 
loop 
  TouchOSC->>oscxyz: OSC /accxyz message
  oscxyz->>p5.js: x,y,z string
end
Loading

Installation

  1. Download the appropriate archive file from the Releases page.
  2. Place the oscxyz executable somewhere in your path
  3. Run it from a terminal window as described below. On MacOS, use the Terminal app. On Windows, you might need to download Windows Terminal from Microsoft.

Or, if you have go installed:

go install github.com/rahji/oscxyz@latest

Usage

On Your Computer

Open a terminal window and run the command using the following syntax:

Usage:
  oscxyz [flags]

Flags:
  -h, --help             help for oscxyz
      --oschost string   IP address to use when creating the OSC server (required)
      --oscport int      Port number to use when creating the OSC server (required)
      --pattern string   OSC message pattern to listen for (default "/accxyz")
  -q, --quiet            Don't show OSC messages on the console
  -v, --values           Only send the values of the OSC message
      --wsport int       Port number to use when creating the WebSockets server (required)

For example:

oscxyz -oschost=192.168.4.20 --oscport=8000 --wsport=8080 --values

On Your Phone

  1. Start TouchOSC
  2. In Settings, touch "OSC" and enter the host IP address and port (outgoing) using the values you typed in the terminal
  3. Also in Settings, touch "Options" and turn on "Accelerometer (/accxyz)"

You should start seeing the accelerometer OSC messages appear in the terminal window where oscxyz is running (unless you used the --quiet flag).

Examples

Look at this separate repo for some p5.js examples.

Issues

  • This currently only works with TouchOSC, I think. This is because it's the only phone app that I've seen that includes all three axes in one OSC message. I will update this tool to work with other apps (like MultiSense Osc), but I'm hesitant to go too far since I intend to make a more comprehensive OSC tool with many more options - probably this summer.
  • oscxyz doesn't handle OSC bundles - only messages.

oscxyz's People

Contributors

rahji avatar

Watchers

 avatar  avatar

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.