Net::OpenSoundControl - OpenSound Control client and server implementation
See Net::OpenSoundControl::Client and Net::OpenSoundControl::Server for the synopsis.
OpenSound Control ("OSC") is a protocol for communication among computers, sound synthesizers, and other multimedia devices that is optimized for modern networking technology. http://www.cnmat.berkeley.edu/OpenSoundControl
This suite of modules provides an implementation of the protocol in Perl, according to version 1.0 (March 26, 2002) of the specification.
To actually create an OSC client or server, take a look at Net::OpenSoundControl::Client and Net::OpenSoundControl::Server. This module only provides several helper functions. Normally, there shouldn't be a need for you to use this module directly.
Please also see the examples/ directory in this distribution, especially if you are not very familiar with references.
OSC data is represented in a form closely related to the original binary format.
A message is an array reference containing an OSC address followed by zero or more pairs of type identifiers and data. Examples:
['/Fader', f, 0.2] ['/Synth/XY', i, 10, i, 200]
A bundle is an array reference that contains the bundle identifier #bundle and a timestamp, followed by zero or more messages. Examples:
#bundle
['#bundle', time() + 0.1, ['/Pitch', 'f', rand(1)] ['#bundle', time() + 2, ['/Slider', 'f', $s], ['/Synth/XY', 'i', $x, 'i', $y]
Note that the time should be expressed in seconds since 1st January 1970, which is what time() returns on UNIX systems. You can pass it a floating point time, the Time::HiRes module will help you find the current time with sub-second accuracy.
A timestamp with the value "0" carries the special meaning of "execute immediately". Example:
['#bundle', 0, ['/Pitch', 'f', rand(1)]
Returns information about the version of the OSC protocol implemented. Currently OSC/1.0.
OSC/1.0
Returns information about the data types implemented. Currently bfis (blobs, floats, ints and strings).
bfis
Decodes binary OSC message or bundle data into a Perl data structure
Encodes OSC messages or bundles into their binary representation
Returns the binary representation of an integer in OSC format
Converts the binary representation of a floating point value in OSC format into a Perl value. (There are no other "from..." functions since the code for that is directly embedded into the decode functons for speed, but this one is separate since it depends on the endianness of the system it's running on).
Returns the binary representation of a floating point value in OSC format
Returns the binary representation of a string in OSC format
Returns the binary representation of a BLOB value in OSC format
Returns the binary representation of a TIMETAG value in OSC format.
Doesn't work with Unicode data. Remember to use bytes if you use Unicode Strings.
use bytes
Hacking Perl in Nightclubs at http://www.perl.com/pub/a/2004/08/31/livecode.html
The OpenSoundControl website at http://www.cnmat.berkeley.edu/OpenSoundControl/
Net::OpenSoundControl::Client
Net::OpenSoundControl::Server
Christian Renz, <crenz @ web42.com>
Timestamp code lifted from Net::NTP.
Test against specification by Alex (yaxu.org).
Copyright 2004-2005 by Christian Renz <crenz @ web42.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::OpenSoundControl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::OpenSoundControl
CPAN shell
perl -MCPAN -e shell install Net::OpenSoundControl
For more information on module installation, please visit the detailed CPAN module installation guide.