“Open Sound Control (Osc) is an open, transport-independent, message-based protocol developed for communication among computers, sound synthesizers, and other multimedia devices.” (from http://opensoundcontrol.org/spec-1_0)
There are a number of Osc implementations, including another in C#, but I decided to roll my own and make it freely available. This implementation sits atop the .NET 4.5 Framework and uses TCP or UDP as the transport protocol. It includes support for Osc Messages and Bundles, and supports the following payload data types: Int32, Int64, Float, Double, String, Blob (byte array), Osc TimeTag, ASCII character, boolean, Nil, Infinitum, and RGBA color.
The OscServer class is at the heart of the system, and includes support for unicast, broadcast, and multicast. As OSC packets, bundles, and messages are received corresponding events are fired. Additionally, the system will (optionally) filter Osc address patterns that the user registers.
The package includes simple client and server examples in both C# and Visual Basic.NET.
Release Notes (version 2.0)
- Updated to .NET 4.0 Framework and Visual Studio 2010.
- Overhauled TCP transport and corrected message framing.
- Added support for Osc TimeTag, ASCII character, boolean, Nil, Infinitum, and RGBA color.
- Events now properly raised for nested Osc bundles and messages.
- Much improved documentation.
- Simplified and separated out functionality in the Bespoke.Common library.
- Changed the default expected byte order (endianness) back to Big endian (as per the OSC specification).
- Improved demo applications.
- General refactoring.
Release Notes (version 1.7.0)
- Fixed TcpServer spinning in its listener thread.
- Changed the default expected byte order (endianness) from Big to Little endian.
- Added OscPacket.LittleEndianByteOrder property to allow users to change the expected byte order.
- Fixed asynchronous, inline data handling within TcpServer. Default data handling behavior for TCP messages is now asynchronous (previously synchronous).
- Added explicit project configurations for x64 platforms and have included pre-compiled x64 binaries (along with x86 binaries).
Release Notes (version 22.214.171.124)
- Added UDP port reuse (multi-cast only). This allows for multiple simultaneous OscServer instances (or other services) bound to the same port.
- Added OscServer.ConsumeParseExceptions (enabled by default) which suppresses parsing exceptions caused by malformed OSC packets. Disable this option to allow such exceptions to bubble up through the OscServer.