next up previous contents index
Next: IXD (Integra eXtensible Data) Up: libIntegra: a system for Previous: Introduction   Contents   Index


Integra modules

The basis of the Integra library is the concept of the Integra module. Integra modules encapsulate a specific piece of message or signal processing functionality. A module could perform a simple task like a numeric addition, or a complex task like emulating a specific synthesiser. In this section, we will outline how Integra modules and module collections are constructed.

Module construction

The minimum requirement for an Integra module is that it must have an interface definition. In addition, it may also have an implementation and module instance data. Of these, only the implementation is software specific.

Module definition

An Integra module definition is data that defines what attributes a module has, and what the characteristics of those attributes are. An Integra attribute is a symbolic name with which a value can be associated. The module definition doesn't store the actual values of attributes, instead it stores data about the attributes such as their names, descriptions, supported data types, maxima and minima, and default values. Typical module definition data is shown in Table [*].

Table: Integra Oscillator interface definition
Field Value
Name Oscillator
Parent Module
Attributes freq, phase
Attribute Unit Codes 1, 2
Attribute Minima 0, 0
Attribute Maxima inf, 6.2831853071795862
Attribute Defaults 440, 0

The parent field is used to show an inheritance relation. All Integra module definitions could be thought of as class definitions, the members of which are all abstract (lack implementation), or interface definitions. The interface of a given class can inherit the interface of any other class, and supplement this with additional members. This definition hierarchy is the basis of the Integra database (see section [*]).

Module namespace

A module's namespace is derived from its definition. The namespace enables the values of attributes to be set, and module methods to be called by using a symbolic naming scheme. From the user's perspective, this will usually manifest itself as an OSC address space. The OSC address space for a sinus module is shown in table [*]. The sinus class inherits the oscillator class interface, which in turn inherits the module class interface, so all of these must be reflected in the module's namespace, and in turn must be represented in the implementation.

Table: Integra Sinus module namespace
OSC address Purpose
/oscillator/freq <value>
Set the value of the 'freq' attribute
/oscillator/phase <value>
Set the value of the 'phase' attribute
/module/active <value>
Set whether or not the module is active

Module implementation

The module implementation is the only software-specific data stored by Integra. It consists of a fragment of computer code, in one or more files, which when run or loaded by a particular piece of software will perform a specific audio or message processing task. In order that module implementations can be used by libIntegra, an implementation protocol must be devised for each software target. Integra currently provides implementation protocols for Max/MSP and Pure Data along with a growing selection of example module implementations and implementation templates. In practice, the implementation files are Max and PD 'abstractions' that provide a number of compulsory methods, and conform to the implementation protocol. A typical module implementation is shown in Figure [*].

Figure: An Integra sine wave oscillator implemented in PD

A SuperCollider class to perform the same task, might look as follows:

Sinus : Oscillator {
     var freq, outPorts, server;
     freq = 440;
     outPorts = [1];
     actions = actions.add(
       {|val| this.server.sendMsg(
         ``/n_set'', nodeid, \freq, val)});
     nodeid = Synth(\Sinus, 
       [\freq, freq, \outport0, outPorts[0]]

This implementation is very different from the PD sinus, not only because it is implemented in a different module host (i.e. SuperCollider), but also because it employs inheritance to provide much of its functionality. In SuperCollider we can use inheritance at the level of implementation to mirror the interface inheritance used in the Integra database, and conceptually between abstract Integra classes. The PD sinus must implement all of the interfaces inherited by the sinus class and its parents, right to the top of the class tree. The SuperCollider sinus only needs to implement the interface that is unique to it, implementations of inherited interfaces are inherited from the parent class: Oscillator.

An eventual aim of Integra is to provide a protocol for constructing module implementations in a range of different software, and to develop a LADSPA/DSSI host that wraps plugins in an Integra-compliant manner.

Module instance data

Module instance data consists of the run-time state of all of its variable parameters. This data is stored in memory by the Integra library whilst a module is in use, and can be written to an XML file on demand. This data is stored in the Integra database in the module's instance table. However only one saved state can be associated with each module instance. If the user wishes to record state changes over time, then a separate 'Player' module must be used to store this data.

Module collections

An Integra collection consists of one or more Integra module instances. A collection can also contain other collections. These contained collections encapsulate the functionality of a number of connected Integra modules into a single entity and can be addressed and connected as if they were normal module instances. The facility is provided for collections to optionally expose the input and output parameters of the modules they contain. For example, the collection 'mySinus' might contain a Sinus module, which has the attributes Frequency and Phase, but the collection might only expose the Frequency attribute to the containing collection, whilst setting the Phase to some arbitrary constant value.

Module ports

Modules and collections are connected up to each other using Integra ports. Each port corresponds to an audio or messaging address, which has both a symbolic name and a numeric identifier (port ID). Port symbolic names correspond to a module's attribute names (e.g. 'freq'), and port numbers are derived implicitly from the index of the port in the module's attribute list. In addition to its port number, each module has a globally unique symbolic name (e.g. 'sinus1'), and an implicitly determined, globally unique numeric identifier (UID). The Integra library can be used to address any module port using either their fully-qualified symbolic name (e.g. '/sinus1/oscillator/freq'), or using a combination of their UID and port ID. It is an important part of the Integra module construction protocol that port ordering is always consistent. Otherwise a module implementation's port numbering will not correspond to the numbering expected by the Integra library.

From the perspective of the Integra library, database, and XML schema, there is no distinction between audio and control rate ports. This distinction is only made in the implementation. There is also no conceptual distinction between input ports and output ports, a port is just an address that can receive data and connect to other addresses. This is illustrated in figure [*] where the first 'route' object corresponds to ports one to four, which in turn correspond to oscillator frequency, oscillator phase, the module 'active' setting, and the audio output. In this example, ports one to three will set the attributes of the sine oscillator when sent a numeric value, and report their current value to any connected ports when sent an empty message.


For each module or collection, the Integra library stores a list of ports that each output port of a given module is connected to. One-to-many, many-to-one or many-to-many connections can easily be established. However, it is important to note that providing this functionality makes it a requirement for the software hosting the modules to support these routings.

Table: Instance host OSC scheme
Command Purpose
/load <module-name>
Instantiate a module in a given target
/remove <module id>
Remove a module instance
/connect<module id> <port number> 
     <module id> <port number>
Connect two ports
/disconnect <module id> <port number> 
         <module id> <port number>
Disconnect two ports
/send <module id> <port number> <value>
Send a value to a port
/direct <module id> <state>
Toggle direct message passing for a module instance

next up previous contents index
Next: IXD (Integra eXtensible Data) Up: libIntegra: a system for Previous: Introduction   Contents   Index
Jamie Bullock, Henrik Frisk