Home   Documentation   Demonstrations   Download

AMICO: Documentation / AMICO Modules / Open-Sound Control (OSC) Interface

 

An OpenSound Control (OSC) interface to AMICO. It runs an OSC server, enabling other modules to update and delete variables, and in also enables definition of OSC adapters, that map variables from the communicator to messages sent to other OSC servers.

How To Run

     java -jar %AMICO_HOME%/bin/amico-opensound.jar [<conf-url>]

 

 

OSC Messages Defined

 

Message Argument(s) Description
/update OSC-string variableName,

OSC-string variableValue

Updates the variable. If the variable does not exist, it will be added.
/delete OSC-string variableName Deletes the variable. If the variable does not exists, nothing happens.


Configuration Files

 

A main configuration file:
 

This is a minimal configuration file that uses default parameters for missing attributes.
Use this file if you want to use default settings.

---------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<osc>
    <osc-adapter url="file:conf/osc/test-adapter.xml"/>
    <osc-adapter url="file:conf/osc/veejey-adapter.xml"/>
</osc>

This is a full configuration file that overrides default parameters.

---------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<osc listen-host="127.0.0.1" listen-port="57110">   <!-- IP address and UDP port for OSC server -->
    <communicator host="localhost" port="3320">
        <!-- Basic parameter for establishing connection with communicator. Module uses TCP connection.
             <command> element define a list of commands that will be sent to communicator
             each time a module establish a connection (see AMICO TCP protocol for details on commands)
        -->

        <command>UPDATE last-loaded-module OSC</command>
        <command>ONUNLOAD DELETE last-loaded-module</command>
    </communicator>


    <osc-adapter url="file:conf/osc/test-adapter.xml"/>
    <osc-adapter url="file:conf/osc/veejey-adapter.xml"/>
    <osc-adapter url="file:conf/osc/veejey-adapter.xml"/>
</osc>

 

 A configuration file for OSC adapter variables (linked from a main configuration file):
 

<?xml version="1.0" encoding="UTF-8"?>
<osc-adapter>
    <message osc-host="localhost" osc-port="9999" message="/video/&lt;%=lives-video%&gt;" trigger-variables="lives-video"/>
    <message osc-host="localhost" osc-port="9999" message="/clip/select" trigger-variables="lives-select-clip">
        <!-- When a variable lives-select-clip changes,

              send an OSC message /clip/select to OSC server at localhost run on poirt 9999

              with one parameter (value of variable lives-select-clip)
        -->

        <parameter param-type="variable" osc-type="int32" value="lives-select-clip"/>
    </message>
    <message osc-host="localhost" osc-port="9999" message="/effect_key/enable" trigger-variables="lives-enable-effect">
        <parameter param-type="variable" osc-type="int32" value="lives-enable-effect"/>
    </message>
    <message osc-host="localhost" osc-port="9999" message="/effect_key/disable" trigger-variables="lives-disable-effect">
        <parameter param-type="variable" osc-type="int32" value="lives-disable-effect"/>
    </message>
</osc-adapter>

 

Example of using OSC interface from other programs

 

This is simple Java program that call updateVariable method using Apache Java osc library.

 

import java.net.*;

import java.io.*;

import java.nio.channels.*;

import de.sciss.net.*;

public class OscTest {

    public static void main( String args[] ) throws Exception {

        OSCTransmitter trns = new OSCTransmitter();

        InetSocketAddress scsynthAddress = new InetSocketAddress( "127.0.0.1", 57110 );

        trns.send( new OSCMessage( "/update", new Object[] { "age", "27" } ), scsynthAddress );

        trns.send( new OSCMessage( "/delete", new Object[] { "age-range" } ), scsynthAddress );

    }

}

 

Validation Logos