OSCMapper:
Filter:
OSCMapper/Classes (extension) | OSCMapper

OSCMapper
ExtensionExtension

An abstraction layer for OSC controllers

Description

OSCMapper is a Quark which intents to simplify the process of controlling SuperCollider with external OSC controllers such as TouchOSC.

Learn OSC controls

With OSCMapper it is possible to automatically create an OSCMapper layout according to the data it received which is often refered to as learning of controllers. Simply turn OSCMapper into learning mode

move the controllers (which should send its messages to the sclang standard port 57120, see NetAddr: *langPort) and once finished stop the learning process which will output a new controller

The detected mapping will be shown at the post video. There are

which all use OSCMapperElement as foundation.

How to use the OSC values

Assuming you have a OSC controller which is sending on address /1/fader and you have set up OSCMapper for this address you can access the value

Creating a layout manually

In case you do not want to learn OscMapper everytime you boot up SuperCollider you can also define the layout manually like

By providing an altName you can access the value also via this name on the mapper, e.g.

See How to use the OSC values above for further infos.

Using a preset

The presets from TouchOSC are already provided and can be simply loaded via

See How to use the OSC values above for further infos.

Using def style access

Each OSCMapper needs to have a unique name. This is for internal reasons (as each Ndef also needs a unique address) but also to make the access to the OSCMapper easier.

Updating a layout

Lets say you want to change or modify an existing layout.

Then we can add another address on the fly by modifying the existing layout

And also modify the existing layout by adding a transformer or a callback.

and also remove an existing element

Class Methods

.new

Will create a new OSCMapper. Will also add a Main: -addOSCRecvFunc which allows us to search trough all OSC messages.

Arguments:

name

Should be unique as we also allow to access the instances in an Ndef manner.

layout

An Event where key is the OSC address and the value is a OSCMapperElement which accepts the value.

port

Defaults to nil which will listen to all ports entered in Main: -openPorts (which can be seen via thisProcess.openPorts which defaults to NetAddr: *langPort which defaults to 57120). If a port is set we will tell sclang to listen on this port as well and we restrict the created OSCMapper to the stated port number. This allows you to use multiple devices with the same layout by using different ports.

.learn

Puts OSCMapper in capture mode. Should be followed by OSCMapper: *finishLearn

.finishLearn

Will create a OSCMapper according to the messages that were received since OSCMapper: *learn was called.

Arguments:

name

See OSCMapper: *new.

.mix2

Constructor with layout for TouchOSC preset Mix 2. For other args see OSCMapper: *new.

Arguments:

name
port

.mix2iPad

Constructor with layout for TouchOSC preset Mix 2 iPad. For other args see OSCMapper: *new.

Arguments:

name
port

.all

Will return an Event with all registered OSCMappers where the key is the name.

.clearAll

Removes all instances of OSCMapper.

.echo

Allows to output the currently received OSC messages, like OSCFunc: *trace. This is useful to identify the touched controls.

Arguments:

echoBool

if true it will print the received values to the Post window. When set to false it will stop posting.

Instance Methods

.at

Allows to access the addresses via e.g. o['/1/fader1']

Arguments:

address

The address or altname given.

.layout

Allows to access and update the given layout. See Updating a layout above on how to use it.

.clear

Removes any server resources and also any callbacks in the language.

Examples

Multitoggles as step sequencer

The layout OSCMapper: *mix2iPad includes a 5x5 matrix which we can use as a 25 step sequencer. The OSC address for these is /1/multitoggleK/i/j where K is the K-th multitoggle, i the column and j the row (so maybe a bit unintuitive but thats how it is in the interface).

Activate a ProxyChain

Play/Stop patterns