Fix OSC receiver port binding, add long attack/decay envelope
This commit is contained in:
parent
2a17339edc
commit
e09fbbae45
|
|
@ -5,11 +5,11 @@
|
||||||
s.boot;
|
s.boot;
|
||||||
s.waitForBoot {
|
s.waitForBoot {
|
||||||
|
|
||||||
// Define synth on the server (2-second ring)
|
// Define synth on the server with long attack and decay
|
||||||
SynthDef(\sineTone, {
|
SynthDef(\sineTone, {
|
||||||
|freq = 440, amp = 0.15|
|
|freq = 440, amp = 0.15|
|
||||||
var env = EnvGen.kr(
|
var env = EnvGen.kr(
|
||||||
Env([0, 1, 1, 0], [0.05, 0.1, 1.85], \sin),
|
Env([0, 1, 0.8, 0], [2, 3.0, 3], \sin),
|
||||||
doneAction: Done.freeSelf
|
doneAction: Done.freeSelf
|
||||||
);
|
);
|
||||||
Out.ar(0, SinOsc.ar(freq) * env * amp);
|
Out.ar(0, SinOsc.ar(freq) * env * amp);
|
||||||
|
|
@ -18,7 +18,7 @@ s.waitForBoot {
|
||||||
// Wait for synth to be added to server
|
// Wait for synth to be added to server
|
||||||
s.sync;
|
s.sync;
|
||||||
|
|
||||||
// OSC handler for /freq messages
|
// OSC handler for /freq messages - explicitly bind to port 57120
|
||||||
~oscHandler = OSCFunc({ |msg, time, addr, recvPort|
|
~oscHandler = OSCFunc({ |msg, time, addr, recvPort|
|
||||||
if (msg.size >= 3, {
|
if (msg.size >= 3, {
|
||||||
var freq = msg[2].asFloat;
|
var freq = msg[2].asFloat;
|
||||||
|
|
@ -26,7 +26,7 @@ s.waitForBoot {
|
||||||
Synth(\sineTone, [\freq, freq, \amp, 0.15]);
|
Synth(\sineTone, [\freq, freq, \amp, 0.15]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, '/freq');
|
}, '/freq', nil, 57120);
|
||||||
|
|
||||||
"OSC receiver ready on port 57120".postln;
|
"OSC receiver ready on port 57120".postln;
|
||||||
"Click nodes in webapp to play".postln;
|
"Click nodes in webapp to play".postln;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue