Giter Club home page Giter Club logo

oscr's Introduction

oscr

A Read Eval Print loop for Open Sound Control messages

Installation

$ npm install -g oscr

Usage

Specify outgoing host and port.

$ oscr -h localhost -p 7777

Specify an incoming port to log OSC messages.

$ oscr -h localhost -p 7777 -i 8000

Then enter some OSC messages.

> /hello iii 1 2 3  # <path> <type-tag> <args>

Surround arguments in quotes to preserve spaces.

> /say ss "hello world" '\"something\" in quotes'
{ path: '/say',
  typetag: 'ss',
  params: [ 'hello world', '"something" in quotes' ] }
Snoop

The snoop argument can be used to help debug communication. It will log all incoming messages and immediately redirect them to the outgoing host and port.

$ oscr -h localhost -p 8000 -i 9999 -s

Tricks

You can use any valid javascript expression as an argument.

> ['','foo','moo'].join('/') "Array(4).join('f') + 'i'" 3-2 "1 + 1" 1*3 Date.now()
{ path: '/foo/moo',
  typetag: 'fffi',
  params: [ 1, 2, 3, 1393227357969 ] }

Not that you would want to do this, though...

oscr's People

Contributors

notlion avatar pizthewiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

oscr's Issues

Unable to send string argument when containing space

Bummer ๐Ÿ˜ข.
If the arguments were comma separated instead of space, single-quoted strings could then be used as arguments. If something like the following were used:

var r = new RegExp('^\\s*(\\S*)\\s*(\\S*)\\s*(.*)$');
function createMessage(line) {
  var matches = r.exec(line);
  if (!matches) {
    console.error('ERROR - something went pear-shaped');
    return;
  }

  return {
    path: evalArg(matches[1]),
    typetag: evalArg(matches[2]) || '',
    params: evalArg('[' + matches[3] + ']')
  };
}

That would then let me send something like this:

> /track1/oscillator1/coarse_tune#<INFO s 'oscillator pitch in semitones'

The regexp stuff above would still have the restriction that for the trick javascript-expression-generating address / typeTag could not contain a space, but I don't think that is a big deal right?

If comma separating args, single quoted strings and the continued space-less trick syntax is, I could clean this up and submit as a PR.

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.