# TouchOSC controlled mixer in Supercollider

**URL:** <https://uzu.lurk.org/t/touchosc-controlled-mixer-in-supercollider/2418>\
**Category:** TidalCycles\
**Tags:** questions\
**Created:** [12 November 2020 16:36 UTC](https://uzu.lurk.org/t/touchosc-controlled-mixer-in-supercollider/2418 "2020-11-12T16:36:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![domha91](https://uzu.lurk.org/user_avatar/uzu.lurk.org/domha91/32/1942_2.png) [@domha91](https://uzu.lurk.org/u/domha91)\
**Post date:** [12 November 2020 16:36 UTC](https://uzu.lurk.org/t/touchosc-controlled-mixer-in-supercollider/2418/1 "2020-11-12T16:36:28Z")

</div>

Hi all. I'm a beginner and I was wondering if anyone has any experience with building a mixer in Supercollider and/or controlling it with touchOSC?

```
var w, spec;
spec = \db.asSpec;
w = Window("Mixer v0.1", Rect(240, 240, 300, 500)).front;

w.view.layout = HLayout(*~dirt.orbits.collect { |x|
    var val = spec.unmap(x.get(\amp).ampdb);
    Slider().value_(val).action_({ |v| x.set(\amp, spec.map(v.value)) })
});

```

Starting with this code i picked up, sorry i can't remember where, I have a GUI mixer that controls the volume of each orbit, albeit in an inverted fashion (pushing them up turns the orbit volume down IIRC)

With 8 of these OSCDefs i am receiving data from faders in touchOSC and posting it in the post window.

```
n = NetAddr("192.168.0.50");

OSCdef.new(
    \fader2,
    {

	    arg msg, time, addr, port;

	    msg[1].postln;

     },
    '/1/fader2',
    n,
    8000
);

```

n is the network address of my phone. 8000 is the default outgoing port from touchOSC to avoid clashing with the default port used for Tidal.

I am hoping more experienced people can help me with connecting these OSCDefs to the Sliders (and putting them the right way up) so that I can control the Sliders with touchOSC on my phone and maybe we can start a more general discussion about building mixers for our live Tidal setups in Supercollider along the way. I will update this thread as I discover new information and share the development of my own mixer.

---

<div class="post-metadata">

**Author:** ![tamlyn](https://uzu.lurk.org/user_avatar/uzu.lurk.org/tamlyn/32/26_2.png) [@tamlyn](https://uzu.lurk.org/u/tamlyn)\
**Post date:** [22 December 2020 22:26 UTC](https://uzu.lurk.org/t/touchosc-controlled-mixer-in-supercollider/2418/2 "2020-12-22T22:26:35Z")

</div>

After a bit of messing around I got this working:

```haskell
~dirt.orbits.collect { |x, i|
	var path = '/osc/slider' ++ (i + 1); // change this
	OSCdef(path.asSymbol, { |msg| x.set(\amp, msg[1]); }, path);
}

```

You may need to change the `path` variable to match the OSC addresses defined on your sliders. You need to put your computer's IP address and SuperCollider port (`57120` by default) into TouchOSC (or whatever app you want to use – I used OSC Controller which is free on Android). You don't need to put the phone's address into SuperCollider as we're not sending messages **to** the phone. You can add that to your startup file after SuperDirt is started.

I'd love to be able to use touch controls more naturally with Tidal. I'm imagining a way of typing some code in the Tidal editor that simultaneously creates a control on the phone and maps the value to a parameter in Tidal, like a super-powered `cF`.

---

<div class="post-metadata">

**Author:** ![domha91](https://uzu.lurk.org/user_avatar/uzu.lurk.org/domha91/32/1942_2.png) [@domha91](https://uzu.lurk.org/u/domha91)\
**Post date:** [10 January 2021 13:12 UTC](https://uzu.lurk.org/t/touchosc-controlled-mixer-in-supercollider/2418/3 "2021-01-10T13:12:11Z")

</div>

You absolute legend. It's all working now, many thanks for that and hope you had a great Christmas and New Year!
