Compare commits

..

No commits in common. "bc282aa727ffcf87ef96dbc03a4e8a9d408d7038" and "e1c1a5b82dd6d435f8b1d88e0150d2cf7f8b021f" have entirely different histories.

4 changed files with 56 additions and 73 deletions

View File

@ -24,24 +24,9 @@ OSCdef.freeAll;
~quantspeed = { |v| 2.pow((v * 4 + 0.5).round - 5) }; ~quantspeed = { |v| 2.pow((v * 4 + 0.5).round - 5) };
~quantharmonics = {
arg f, quantise=0;
quantise.postln;
if(quantise != 0, {
var fraction = f.asFraction(7, false);
[f, fraction].postln;
fraction[0] / fraction[1];
},
{ f }
);
};
// control ganging is hella laggy, do it in TouchOSC // control ganging is hella laggy, do it in TouchOSC
~setspeed = { | track, v | ~setspeed = { | track, v |
var speed, qv = if(~speedquant > 0, { ~quantspeed.value(v) }, { v }); var speed, qv = if(~speedquant > 0, { ~quantspeed.value(v) }, { v });
speed = qv / ~buflen; speed = qv / ~buflen;
@ -109,15 +94,6 @@ OSCdef.freeAll;
~to.button('/grains/quant', 0, { |v| ~speedquant = v }); ~to.button('/grains/quant', 0, { |v| ~speedquant = v });
~to.button('/grains/metronome', 0, { |v|
if( v == 1, {
~bps = ~beatsperbar / ~buflen;
~tc.tempo_(~bps);
});
~metromix.set(\amp, v)
});
// Page 2: track // Page 2: track
@ -134,9 +110,6 @@ OSCdef.freeAll;
~to.button('/track/slope', 0, { |v| ~granulator.slope_(v) }); ~to.button('/track/slope', 0, { |v| ~granulator.slope_(v) });
~to.button('/track/chorus', 0, { |v| ~granulator.chorus_(v) }); ~to.button('/track/chorus', 0, { |v| ~granulator.chorus_(v) });
~to.slider('/track/harmonics', 2, TouchOSCScale(0.5, 3), { |v|
~granulator.harmonics_(~quantharmonics.value(v, 1))
});
~to.slider('/track/detune', 0, TouchOSCScale(0, 0.059), { |v| ~granulator.detune_(v) }); ~to.slider('/track/detune', 0, TouchOSCScale(0, 0.059), { |v| ~granulator.detune_(v) });
~to.slider('/track/pitch', 0, TouchOSCScale(-2, 2), { |v| ~granulator.pitch_(v.round) }); ~to.slider('/track/pitch', 0, TouchOSCScale(-2, 2), { |v| ~granulator.pitch_(v.round) });
@ -161,7 +134,6 @@ OSCdef.freeAll;
~to.v_('/track/slope', ~granulator.slope); ~to.v_('/track/slope', ~granulator.slope);
~to.v_('/track/back', ~granulator.back); ~to.v_('/track/back', ~granulator.back);
~to.v_('/track/chorus', ~granulator.chorus); ~to.v_('/track/chorus', ~granulator.chorus);
~to.v_('/track/harmonics', ~granulator.harmonics);
~to.v_('/track/detune', ~granulator.detune); ~to.v_('/track/detune', ~granulator.detune);
~to.v_('/track/pitch', ~granulator.pitch); ~to.v_('/track/pitch', ~granulator.pitch);
}); });
@ -214,6 +186,52 @@ OSCdef.freeAll;
~to.slider('/lfos/cfreq', 0.5,TouchOSCScale(0.1, 200), { |v| ~lfoc.set(\freq, v) } ); ~to.slider('/lfos/cfreq', 0.5,TouchOSCScale(0.1, 200), { |v| ~lfoc.set(\freq, v) } );
~to.slider('/lfos/camp', 0, TouchOSCScale(0, 1), { |v| ~lfoc.set(\amp, v) }); ~to.slider('/lfos/camp', 0, TouchOSCScale(0, 1), { |v| ~lfoc.set(\amp, v) });
// metronome code here is a bit gross but easier
~beatsperbar = 4;
~bps = ~beatsperbar / ~buflen;
~tc = TempoClock.new(~bps);
SynthDef(\metronome, {
arg out=0, amp=1, pan=0, filter=1000, atk=0.01, rel=0.1;
var sig, env;
env = EnvGen.kr(Env.perc(atk, rel, amp), doneAction: Done.freeSelf);
sig = HPF.ar(WhiteNoise.ar(), filter);
Out.ar(out, Pan2.ar(sig * env, pan));
}
).add;
~metrob = Bus.audio(s, 2);
~metromix = SynthDef(\metromix, {
arg in=1, out=0, amp=1;
Out.ar(out, amp * In.ar(in, 2));
}).play(s, [\in, ~metrob, \out, 0, \amp, 0]);
~metronome = Pbind(
\instrument, \metronome,
\dur, 1,
\amp, 0.5,
\pan, 0,
\out, ~metrob
).play(~tc);
~to.button('/grains/metronome', 0, { |v|
// reset tempo when turning metronome on
if( v == 1, {
~bps = ~beatsperbar / ~buflen;
~tc.tempo_(~bps);
});
// FIXME
~metromix.set(\amp, v)
});
) )

View File

@ -11,15 +11,6 @@ Server.killAll;
( (
Routine.run({ Routine.run({
~usbinput = 2;
~usbinput1 = 2;
~usbinput2 = 3;
~buflen = 4.0;
~beatsperbar = 4;
~touchosc_ip = "192.168.0.209";
("./synths.scd").loadRelative; ("./synths.scd").loadRelative;
Granulator.init(s); Granulator.init(s);
s.sync; s.sync;
@ -29,10 +20,11 @@ Routine.run({
s.sync; s.sync;
("./effects.scd").loadRelative; ("./effects.scd").loadRelative;
s.sync; s.sync;
("./sequencer.scd").loadRelative; ~touchosc_ip = "192.168.0.209";
s.sync;
("./interface.scd").loadRelative; ("./interface.scd").loadRelative;
}); });
) )

View File

@ -1,34 +0,0 @@
(
~bps = ~beatsperbar / ~buflen;
~tc = TempoClock.new(~bps);
SynthDef(\metronome, {
arg out=0, amp=1, pan=0, filter=1000, atk=0.01, rel=0.1;
var sig, env;
env = EnvGen.kr(Env.perc(atk, rel, amp), doneAction: Done.freeSelf);
sig = HPF.ar(WhiteNoise.ar(), filter);
Out.ar(out, Pan2.ar(sig * env, pan));
}
).add;
~metrob = Bus.audio(s, 2);
~metromix = SynthDef(\metromix, {
arg in=1, out=0, amp=1;
Out.ar(out, amp * In.ar(in, 2));
}).play(s, [\in, ~metrob, \out, 0, \amp, 0]);
~metronome = Pbind(
\instrument, \metronome,
\dur, 1,
\amp, 0.5,
\pan, 0,
\out, ~metrob
).play(~tc);
)

View File

@ -1,5 +1,12 @@
( (
~usbinput = 2;
~usbinput1 = 2;
~usbinput2 = 3;
~buflen = 4.0;
~beatsperbar = 4;
SynthDef(\pos_sine, { SynthDef(\pos_sine, {
arg out, speed=1; arg out, speed=1;
Out.kr(out, 0.5 + SinOsc.kr(speed * 0.5, 0, 0.5)); Out.kr(out, 0.5 + SinOsc.kr(speed * 0.5, 0, 0.5));