Skip to content

Commit 2ee443e

Browse files
committed
Change quickstart flow
1 parent aa19819 commit 2ee443e

File tree

1 file changed

+70
-45
lines changed

1 file changed

+70
-45
lines changed

README.md

Lines changed: 70 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

33
![OSC Mapper logo](logo.png)
44

5-
An abstraction layer for OSC controllers and SuperCollider.
6-
Allows learning of controls and much more.
5+
A high level library to interact with SuperCollider via an OSC controller.
6+
Allows to use an OSC layout which is
7+
8+
* pre-defined as preset (e.g. Mix 2 from TouchOSC)
9+
* custom defined as code
10+
* learned by modifying the controllers
11+
12+
and use the values of the controller as
13+
14+
* within a Synth as a `Bus` or a `Ndef`
15+
* within the language via `.value` or via a callback to controll e.g. effects
16+
* within a Pattern via `Pdefn`
717

818
## Installation
919

@@ -18,31 +28,9 @@ HelpBrowser.openHelpFor("Classes/OSCMapper");
1828

1929
## Quickstart
2030

21-
### Learn OSC commands
22-
23-
Based on the input OSCMapper receives it will try to guess what kind of interface the address represents.
24-
25-
```supercollider
26-
// turn OSC Mapper into learning mode
27-
OSCMapper.learn;
28-
// move (all) controllers
29-
// when finished create a new controller
30-
m = OSCMapper.finishLearn(\myController);
31-
32-
// now we can simply use the controller values in an ndef
33-
(
34-
Ndef(\mySound, {
35-
var sig = Saw.ar(LFDNoise1.kr(2.5!2).exprange(400, 410));
36-
sig = sig * m['/1/fader1'].asNdef;
37-
sig;
38-
}).play;
39-
)
40-
Ndef(\mySound).clear(1.0);
41-
```
42-
43-
### Static layout
31+
### Creating a layout
4432

45-
If you want to establish a fixed layout you can also provide a static layout.
33+
You can either define the layout manually
4634

4735
```supercollider
4836
(
@@ -58,34 +46,71 @@ o = OSCMapper(\myLayout, (
5846
altName: \touchPanel
5947
),
6048
));
49+
```
6150

62-
Ndef(\mySound, {
63-
SinOscFB.ar(
64-
freq: LFDNoise1.kr(o[\fader1].asNdef!2).exprange(200, 400),
65-
feedback: o[\touchPanel].x.asNdef,
66-
) * o[\touchPanel].y.asNdef;
67-
}).play;
68-
)
51+
or use a preset like `Mix 2` from TouchOSC like
52+
53+
```supercollider
54+
o = OSCMapper.mix2(\myLayout);
6955
```
7056

71-
### Use a preset
57+
or learn a custom controller on the fly
58+
59+
```supercollider
60+
OSCMapper.learn;
61+
// move controls
62+
o = OSCMapper.finishLearn(\myLayout);
63+
```
7264

73-
If you use e.g. TouchOSC you can also easily use existing presets like this
65+
### Using the controller within SuperCollider
66+
67+
#### As Ndef
68+
69+
```supercollider
70+
// the osc mapper we created earlier can also be accessed in def style
71+
o = OSCMapper(\myLayout);
72+
73+
Ndef(\mySine, {SinOsc.ar!2 * o['/1/fader1'].asNdef}).play;
74+
75+
Ndef(\mySine).clear(2);
76+
```
77+
78+
#### As bus
7479

7580
```supercollider
76-
o = OSCMapper.mix2;
81+
// use the default synth
82+
s = Synth(\default);
83+
s.map(\amp, o['/1/fader1'].asBus);
84+
s.free;
85+
```
7786

87+
#### In a pattern via Pdefn
88+
89+
```supercollider
7890
(
79-
Ndef(\mySound, {
80-
SinOscFB.ar(
81-
freq: LFDNoise1.kr([
82-
o['/3/xy2'].x.asNdef,
83-
o['/3/xy2'].y.asNdef
84-
]).exprange(200, 600),
85-
feedback: o['/3/xy1'].x.asNdef,
86-
) * o['/3/xy1'].y.asNdef;
87-
}).play;
91+
p = Pbind(
92+
\instrument, \default,
93+
\dur, 0.5,
94+
\degree, Pxrand((0..10), inf),
95+
\amp, o['/1/fader1'].asPdefn,
96+
).play;
8897
)
98+
99+
p.stop;
100+
```
101+
102+
#### As raw value access
103+
104+
```supercollider
105+
o['/1/fader1'].value;
106+
```
107+
108+
#### Add a callback on change
109+
110+
```supercollider
111+
o['/1/fader1'].callback = {|v| "value is now %".format(v).postln};
112+
// and free the callback
113+
o['/1/fader1'].callback = {};
89114
```
90115

91116
## License

0 commit comments

Comments
 (0)