mathr / blog / #

Oscintillate: a command-line OSC sequencer

I did a google search for " 'command line' 'osc sequencer' ", and got absolutely no results. Same with the search "oscintillate". So I thought I'd write one and call it that. Currently what I've done so far, using C++ STL, liblo, libxml++, and lots of caffeine:

  1. a program that dumps all OSC input to the console (but not in a useable format yet);
  2. a valid XML schema for stored OSC data (basically a translation of the specification plus some extra <time> tags);
  3. a tiny hand-written example XML file that validates against the schema;
  4. startings of an XML file parser that loads OSC XML data;
  5. startings of a player to play OSC data;
  6. a C++ class that lets me write out well-formed XML data using "<<" - the well-formedness isn't 100% guaranteed, but I think I will be able to achieve that with some work, but for now it is good enough;

I'll release the code under GPL once I get it working to the state where it can:

  1. reliably record incoming OSC data to an XML file in real time;
  2. reliably play back OSC data from an XML file in real time;

Meanwhile, here's a usage example for my XMLOutputStream class:

#include <iostream>

#include "XMLOutputStream.hh"

using namespace oscintillate;

int main() {
    XMLOutputStream xmlos(std::cout);
    xmlos <<
xml::tag("html") <<
 xml::tag("head") <<
 xml::attr("lang") << "en" <<
 xml::attr("encoding") << "UTF-8" <<
  xml::tag("title") <<
   xml::text() << "XMLOutputStream test" <<
  xml::end() <<
 xml::end() <<
 xml::tag("body") <<
  xml::tag("p") <<
   xml::text() << "test<>&\"'test" <<
   xml::tag("br") << xml::end() <<
   xml::tag("a") <<
    xml::attr("href") << "http://example.com?a=1&b=2" <<
    xml::text() << "test<>&\"'test" <<
   xml::end() <<
   xml::tag("hr") << xml::attr("width") << "100%" << xml::end() <<
   xml::text() << "test<>&\"'test" <<
  xml::end() <<
 xml::end() <<
xml::end();
    return (0);
}