NAME
Audio::OSC - OpenSound Control client and server implementation
SYNOPSIS
use Audio::OSC;
# see below
DESCRIPTION
OpenSound Control ("OSC") is a protocol for communication among computers,
sound synthesizers, and other multimedia devices that is optimized for
modern networking technology.
L<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 Audio::OSC::Client and Audio::OSC::Server. This module only provides several helper functions. Normally, there shouldn't be a need for you to use this module directly.
This is an alpha-quality release. Data structures and interfaces are subject to change.
DATA FORMAT
OSC data is represented in a form closely related to the original binary format.
MESSAGES
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]
BUNDLES
A bundle is an array reference that contains the bundle identifier #bundle
and a timestamp, followed by zero or more messages. Examples:
['#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)]
FUNCTIONS
- protocol()
-
Returns information about the version of the OSC protocol implemented. Currently
OSC/1.0
. - types()
-
Returns information about the data types implemented. Currently
bfis
(blobs, floats, ints and strings). - decode($data)
-
Decodes binary OSC message or bundle data into a Perl data structure
- encode($data)
-
Encodes OSC messages or bundles into their binary representation
- toInt($n)
-
Returns the binary representation of an integer in OSC format
- toFloat($n)
-
Returns the binary representation of a floating point value in OSC format
- toString($str)
-
Returns the binary representation of a string in OSC format
- toBlob($d)
-
Returns the binary representation of a BLOB value in OSC format
- toTimetag($d)
-
Returns the binary representation of a TIMETAG value in OSC format.
BUGS
Doesn't work with Unicode data. Remember to use bytes
if you use Unicode Strings.
Tests only show that encoding and decoding match, but don't test against OSC spec yet.
SEE ALSO
The OpenSoundControl website at http://www.cnmat.berkeley.edu/OpenSoundControl/
AUTHOR
Christian Renz, <crenz@web42.com>
Timestamp code by Alex (yaxu.org).
COPYRIGHT AND LICENSE
Copyright 2004 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.