Giter Site home page Giter Site logo

oscmapper's Introduction

OSC Mapper

OSC Mapper logo

A high level library to interact with SuperCollider via an OSC controller. Allows to use an OSC layout which is

  • pre-defined as preset (e.g. Mix 2 from TouchOSC)
  • custom defined as code
  • learned by modifying the controllers

and use the values of the controller as

  • within a Synth as a Bus or a Ndef
  • within the language via .value or via a callback to controll e.g. effects
  • within a Pattern via Pdefn

Installation

// install the quark
Quarks.install("https://github.com/capital-G/OSCMapper.git");
// restart the interpreter so the new classes are available
thisProcess.recompile;
// open documention
HelpBrowser.openHelpFor("Classes/OSCMapper");

Quickstart

Creating a layout

You can either define the layout manually

(
o = OSCMapper(\myLayout, (
    '/1/fader1': OSCMapperFader(
        altName: \fader1,
        defaultValue: 0.5,
        transformer: linlin(_, 0.0, 1.0, 0.5, 10.0),
        callback: {|v| ["received a value", v].postln;},
        lag: 0.5,
    ),
    '/1/xy1': OSCMapperXY(
        altName: \touchPanel
    ),
));

or use a preset like Mix 2 from TouchOSC like

o = OSCMapper.mix2(\myLayout);

or learn a custom controller on the fly

OSCMapper.learn;
// move controls
o = OSCMapper.finishLearn(\myLayout);

Using the controller within SuperCollider

As Ndef

// the osc mapper we created earlier can also be accessed in def style
o = OSCMapper(\myLayout);

Ndef(\mySine, {SinOsc.ar!2 * o['/1/fader1'].asNdef}).play;

Ndef(\mySine).clear(2);

As bus

// use the default synth
s = Synth(\default);
s.map(\amp, o['/1/fader1'].asBus);
s.free;

In a pattern via Pdefn

(
p = Pbind(
    \instrument, \default,
    \dur, 0.5,
    \degree, Pxrand((0..10), inf),
    \amp, o['/1/fader1'].asPdefn,
).play;
)

p.stop;

As raw value access

o['/1/fader1'].value;

Add a callback on change

o['/1/fader1'].callback = {|v| "value is now %".format(v).postln};
// and free the callback
o['/1/fader1'].callback = {};

License

GPL-2.0

oscmapper's People

Contributors

capital-g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

oscmapper's Issues

Add different listening port

Don't know if this is possible as we rely on SC to open the port etc, but probably is possible.

But adding this would have the implication that a nedf with name /oscMappe_{/my/ddress} is not unique anymore and we need to add the namespace of the mapper to the name of the ndef.

Add static controller binding

Learning is nice but if I know beforehand what to do than learning is unhandy.
This is probably only a documentation thing as it already works like this.

OSCMapper(\foo, (
	'/1/fader1': OSCMapperFader(
		altName: \myFader,
		defaultValue: 0.5,
		transformer: linlin(_, 0.0, 1.0, 100.0, 400.0),
		callback: {|v| v.postln},
	),
));

Multiple XY do not get updated properly

E.g.

o = OSCMapper.mix2;


(
Ndef(\mySound, {
    SinOscFB.ar(
        freq: LFDNoise1.kr([
            o['/3/xy2'].x.asNdef,
            o['/3/xy2'].y.asNdef 
        ]).exprange(200, 600),
        feedback: o['/3/xy1'].x.asNdef,
    ) * o['/3/xy1'].y.asNdef;
}).play;
)

Where /xy/1 also updates the volume and vice versa.

Write docs

  • How to update a layout
  • How to access using def syle

Implement cleanup

Check if a clean up is possible in case multiple controllers are used

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.