OSC for Arduino 1.3

This is an Arduino and Teensy library implementation of the OSC encoding (http://opensoundcontrol.org)
It was developed primarily by Yotam Mann and Adrian Freed at CNMAT where OSC was invented.
It benefits from contributions from  John MacCallum, Matt Wright, Jeff Lubow and Andy Schmeder
and many beta testers.

- Supports the four basic OSC data types (32-bit integers, 32-bit floats, strings, and blobs - arbitrary length byte sequences)
- Supports the optional 64-bit timetag data type and Booleans
- Address pattern matching
- Dynamic memory allocation
- Sends and receives OSC packets over transport layers that implements the Arduino Stream Class such as Serial and  Ethernet UDP
- It has been tested on Basic Arduinos, Lilypads, Flora, Arduino Ethernet, Arduino Leonardo, Teensy primarily with the Wiznet W5100 chip

New in this release:

- A new api for producing timetags with initial implementations for teensy 3, teensy 2 and Atmega Arduinos
- Now works on the Due with Arduino 1.5 beta (serial is tested but not UDP yet)
- Sketches compile also in MPIDE for PIC32's there has been limited testing on the Fubarino MINI
(watch out on this platform: it connects and numbers digital pins in use for USB and clock XTAL!)
- Added Boolean type according to OSC 1.0 optional type spec. (lightly tested)

Arduino Yun and related openwrt/arduino hybrids

Marco Brianza has created a useful approach to running this OSC library on the 32u4 in the Yun: https://github.com/cylinderlight/udp2serial
Reliability of this approach (and all the Yun interprocess libraries) will require kernel changes to Linino so we have deferred
Yun support to a future release...

Goals  for next release:
- Support for the Yun and Spark Core
- Unit testing
- Better Time Tags that avoid the overflow limitation of Arduino timer code
- Time Tag synchronization
- Support for Arduino WiFi
Goals for future releases:
- nested bundles
- TCP/IP Examples
- examples for more applications (i.e. TouchOSC, Processing with SLIP)
- deadline scheduling of OSC 64-bit timetags
- ADK support

API Documentation and examples are available at http://cnmat.berkeley.edu/oscuino
This is an active development and research project with revisions available ont GIT repository:
 https://github.com/CNMAT/OSC.
We welcome and appreciate your contributions and feedback there.

Our primary test platform for new development is the Teensy 3.0 which currently offers the best performance
of any of the Arduinos and variants. We greatly appreciate Paul Stoffregen's ongoing work
with "best practice" engineering of high performance microcontrollers.


////////////////////////////////////////////////////////////////////////
SLIPSerial

The OSC for Arduino library  includes extensions of the USB serial and Hardware serial functions of the Arduino core that sends and receives data using the SLIP encoding.
This makes Max/MSP and PD integration very simple using CNMAT's o.io.slipserial.
The SLIPSerial library implements the same methods as the Serial object with additional "beginPacket" and "endPacket" methods to 
mark the boundaries of each packet in a serial stream. 

////////////////////////////////////////////////////////////////////////
Installation from GitHub

We recommend Arduino 1.05 or greater and Teensyduino 1.14 or later if you use the Teensy.
Download the zip from github. Unzip it and remove text after the "-" in the name (i.e. -master) because
the Arduino IDE doesn't allow certain characters in library names.
Move the OSC folder into your "libraries" folder in your Arduino Sketch search path. 
Now you will see OSC examples under the Examples menu of Arduino.


The Applications folder contains examples for Max/MSP and PD and Processing that work with the example sketches. This will be expanded to include other applications like TouchOSC and Processing
For the Max/MSP examples you will need to download the CNMAT max externals package that includes the "o." objects available at http://cnmat.berkeley.edu/downloads
////////////////////////////////////////////////////////////////////////
Guide

As well as many small examples illustrating the API, there is a larger application called "oscuino"
that illustrates how to use OSC to simplify situations Firmata and Maxuino  are typically used in.
////////////////////////////////////////////////////////////////////////
Performance

Currently best performance is achieved with Arduinos with built-in USB Serial, i.e. Teensy 3.0, Teensy 2.0 and 2.0++ and Leanardo variants (12Mbps max)

This is because the Wiznet 5100 used in the Ethernet Arduino and shields uses really slow SPI (0.3Mbps)
This will change as people retool to use the much faster Wiznet 5200 which has been measured with the Due at 6Mbps
http://forum.pjrc.com/threads/17951-WIZ820io-Ethernet-and-2nd-power-supply-with-teensy-3-0
http://arduino.cc/forum/index.php?topic=139147.0

The serial examples use a 9600 baud rate which is reliable on most of the FTDI based Arduinos.
The slow rate is required for Arduino's without clock chips such as the TinyLili.
Once you have established that things work at 9600 baud you will find it very beneficial to increase the rate.
e.g. Serial.begin(345600);   // !! 115200, 230400, 345600,   460800 X

////////////////////////////////////////////////////////////////////////
License

 Written by Yotam Mann and Adrian Freed, The Center for New Music and Audio Technologies,
 University of California, Berkeley.  Copyright (c) 2013, The Regents of
 the University of California (Regents).
 
 Permission to use, copy, modify, distribute, and distribute modified versions
 of this software and its documentation without fee and without a signed
 licensing agreement, is hereby granted, provided that the above copyright
 notice, this paragraph and the following two paragraphs appear in all copies,
 modifications, and distributions.
 
 IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
 SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
 OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
 BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
 HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
