Compare commits
No commits in common. "9f7b83a44eb68a56be3a7f95cbeef2651853d0a4" and "58117762a66473a21d7278853413669219e9f3d4" have entirely different histories.
9f7b83a44e
...
58117762a6
|
@ -4,7 +4,9 @@
|
|||
~modes = [
|
||||
[ "saw", \pos_saw ],
|
||||
[ "reverse", \pos_reverse ],
|
||||
[ "sine", \pos_sine ]
|
||||
[ "sine", \pos_sine ],
|
||||
[ "step", \pos_step ],
|
||||
[ "random", \pos_random ]
|
||||
];
|
||||
|
||||
~outputDir = Platform.recordingsDir +/+ "GrainBuffers";
|
||||
|
@ -13,17 +15,15 @@
|
|||
~grainsb = Bus.audio(s, 2);
|
||||
|
||||
~granulators = Array.new(4);
|
||||
~grainmodes = [ 0, 0, 0, 0 ]; // keep track of mode so don't swap if not needed
|
||||
~speeds = [ 1, 1, 1, 1 ]; // hacky speed quantisation
|
||||
~posb = Array.new(4);
|
||||
~rectriggerb = Array.new(4);
|
||||
~patterns = Array.new(4);
|
||||
~players = Array.new(4);
|
||||
~loopsynths = Array.new(4);
|
||||
~possynths = Array.new(4);
|
||||
~triggersynths = Array.new(4);
|
||||
|
||||
// create the control busses
|
||||
|
||||
(0..3).do({
|
||||
var ps;
|
||||
~posb.add(Bus.control(s, 1));
|
||||
~rectriggerb.add(Bus.control(s, 1));
|
||||
});
|
||||
|
@ -35,59 +35,29 @@
|
|||
~granulators.add(Granulator.new(~buflen, ~infxb, ~grainsb, pb, rtb));
|
||||
});
|
||||
|
||||
// set up the Patterns which drive the position synths
|
||||
|
||||
// launch the pos synths and triggers to sync the buffer recorders
|
||||
|
||||
(0..3).do({ |i|
|
||||
~patterns.add(~makePattern.value(i, 0, ~speeds[i]));
|
||||
var pb = ~posb[i], rtb = ~rectriggerb[i];
|
||||
~possynths.add(Synth(\pos_saw, [ \out, pb, \speed, 1 / ~buflen ]));
|
||||
~triggersynths.add(Synth(\trigger, [ \out, rtb, \freq, 1 / ~buflen ]));
|
||||
});
|
||||
|
||||
(0..3).do({|i|
|
||||
~players.add(~patterns[i].play(~tc, quant: ~beatsperbar))
|
||||
});
|
||||
// TODO - retrigger the buffer records when changing the length etc
|
||||
|
||||
~setmode = {
|
||||
arg track, mode;
|
||||
if( ~grainmodes[track] != mode, {
|
||||
~grainmodes[track] = mode;
|
||||
~players[track].stop;
|
||||
~patterns[track].free;
|
||||
~patterns[track] = ~makePattern.value(track, mode, ~speeds[track]);
|
||||
~players[track] = ~patterns[track].play(~tc, quant: ~beatsperbar);
|
||||
var synth = ~modes[mode][1];
|
||||
~possynths[track].get(\speed, { | speed |
|
||||
~possynths[track].free;
|
||||
~triggersynths[track].free;
|
||||
~possynths[track] = Synth(synth, [\out, ~posb[track], \speed, speed]);
|
||||
~triggersynths[track] = Synth(\trigger, [ \out, ~rectriggerb[track] ]);
|
||||
});
|
||||
~granulators[track].mode_(mode);
|
||||
};
|
||||
|
||||
~setspeed = {
|
||||
arg track, speed;
|
||||
[ "setspeed", track, speed ].postln;
|
||||
if( ~speeds[track] != speed, {
|
||||
~speeds[track] = speed;
|
||||
~players[track].stop;
|
||||
~patterns[track].free;
|
||||
~patterns[track] = ~makePattern.value(track, ~grainmodes[track], ~speeds[track]);
|
||||
~players[track] = ~patterns[track].play(~tc, quant: ~beatsperbar);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
~makePattern = {
|
||||
arg track, mode, speed;
|
||||
var ptrig, ppos, synth = ~modes[mode][1];
|
||||
// note: trigger is going off the base tempoclock, not the playback speed - I think this is
|
||||
// the right thing to do but I'm not sure yet
|
||||
ptrig = Pbind(
|
||||
\instrument, \trigger,
|
||||
\dur, ~beatsperbar,
|
||||
\out, ~rectriggerb[track]
|
||||
);
|
||||
ppos = Pbind(
|
||||
\instrument, synth,
|
||||
\dur, ~beatsperbar / speed,
|
||||
\length, ~buflen / speed,
|
||||
\out, ~posb[track]
|
||||
);
|
||||
Ppar([ptrig, ppos]);
|
||||
};
|
||||
|
||||
|
||||
~dumpbuffers = { |prefix|
|
||||
(0..3).do({|i|
|
||||
var filename = ~outputDir +/+ prefix ++ 'buffer' ++ i.asString ++ '.aiff';
|
||||
|
|
|
@ -36,6 +36,25 @@ OSCdef.freeAll;
|
|||
};
|
||||
|
||||
|
||||
// control ganging is hella laggy, do it in TouchOSC
|
||||
|
||||
|
||||
|
||||
// ~setspeed = { | track, v |
|
||||
// var speed, qv = if(~speedquant > 0, { ~quantspeed.value(v) }, { v });
|
||||
// speed = qv / ~buflen;
|
||||
// if(~speedlock > 0, {
|
||||
// (0..3).do({|n|
|
||||
// ~possynths[n].set(\speed, speed);
|
||||
// if( n != track, {
|
||||
// var url = ("/grains/speed" ++ n).asSymbol;
|
||||
// ~to.s_(url, v);
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
// { ~possynths[track].set(\speed, speed) });
|
||||
// };
|
||||
|
||||
// setrecord: toggles record on (1) or off (0) for a track, and also sets the
|
||||
// track's input mix to 0 so that it doesn't start fadeing out. If the track
|
||||
// is the currently selected track, set its touchosc control to 0.
|
||||
|
@ -66,17 +85,15 @@ OSCdef.freeAll;
|
|||
~to.slider('/grains/buflen', ~buflen, TouchOSCScale(0.1, 10.0), {});
|
||||
|
||||
|
||||
~to.button('/grains/mode0', 0, { |v| ~setmode.value(0, v) });
|
||||
~to.button('/grains/mode1', 0, { |v| ~setmode.value(1, v) });
|
||||
~to.button('/grains/mode2', 0, { |v| ~setmode.value(2, v) });
|
||||
~to.button('/grains/mode3', 0, { |v| ~setmode.value(3, v) });
|
||||
|
||||
// needs work
|
||||
|
||||
~to.slider('/grains/speed0', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(0, ~quantspeed.value(v)) });
|
||||
~to.slider('/grains/speed1', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(1, ~quantspeed.value(v)) });
|
||||
~to.slider('/grains/speed2', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(2, ~quantspeed.value(v)) });
|
||||
~to.slider('/grains/speed3', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(3, ~quantspeed.value(v)) });
|
||||
// ~to.button('/grains/mode0', 0, { |v| ~granulators[0].mode_(v); ~setmode.value(0, v) });
|
||||
// ~to.button('/grains/mode1', 0, { |v| ~granulators[1].mode_(v); ~setmode.value(1, v) });
|
||||
// ~to.button('/grains/mode2', 0, { |v| ~granulators[2].mode_(v); ~setmode.value(2, v) });
|
||||
// ~to.button('/grains/mode3', 0, { |v| ~granulators[3].mode_(v); ~setmode.value(3, v) });
|
||||
//
|
||||
// ~to.slider('/grains/speed0', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(0, v) });
|
||||
// ~to.slider('/grains/speed1', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(1, v) });
|
||||
// ~to.slider('/grains/speed2', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(2, v) });
|
||||
// ~to.slider('/grains/speed3', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(3, v) });
|
||||
|
||||
|
||||
~to.slider('/grains/passthrough', 0.75, TouchOSCScale(0, 1), { |v| ~grainmixer.set(\passthrough, v) });
|
||||
|
@ -88,7 +105,7 @@ OSCdef.freeAll;
|
|||
|
||||
~to.button('/grains/lock', 0, { |v| ~speedlock = v });
|
||||
|
||||
~to.button('/grains/quant', 1, { |v| ~speedquant = v });
|
||||
~to.button('/grains/quant', 0, { |v| ~speedquant = v });
|
||||
|
||||
~to.button('/grains/metronome', 0, { |v|
|
||||
if( v == 1, {
|
||||
|
|
15
main.scd
15
main.scd
|
@ -32,15 +32,24 @@ Routine.run({
|
|||
s.sync;
|
||||
("./control.scd").loadRelative;
|
||||
s.sync;
|
||||
|
||||
});
|
||||
)
|
||||
|
||||
("./granulator.scd").loadRelative;
|
||||
s.sync;
|
||||
|
||||
|
||||
(
|
||||
Routine.run({
|
||||
("./effects.scd").loadRelative;
|
||||
s.sync;
|
||||
("./sequencer.scd").loadRelative;
|
||||
s.sync;
|
||||
~buflen.sleep;
|
||||
"loading interface".postln;
|
||||
("./interface.scd").loadRelative;
|
||||
});
|
||||
)
|
||||
|
||||
~posb[0].scope
|
||||
~granulators[0].grainamp_(0);
|
||||
~granulators[0].loopsynth
|
||||
~dumpbuffers.value("looptober23")
|
|
@ -2,6 +2,14 @@
|
|||
(
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
@ -13,7 +21,7 @@
|
|||
|
||||
~metronome = Pbind(
|
||||
\instrument, \metronome,
|
||||
\dur, ~beatsperbar,
|
||||
\dur, 1,
|
||||
\amp, 0.5,
|
||||
\pan, 0,
|
||||
\out, ~metrob
|
||||
|
|
15
synths.scd
15
synths.scd
|
@ -1,18 +1,18 @@
|
|||
(
|
||||
|
||||
SynthDef(\pos_saw, {
|
||||
arg out, length=1;
|
||||
Out.kr(out, EnvGen.kr(Env([0, 1], length), doneAction: Done.freeSelf))
|
||||
arg out, dur=1;
|
||||
Out.kr(out, EnvGen.kr(Env([0, 1], dur), doneAction: Done.freeSelf))
|
||||
}).add();
|
||||
|
||||
SynthDef(\pos_sine, {
|
||||
arg out, length=1;
|
||||
Out.kr(out, EnvGen.kr(Env.sine(length, 1), doneAction: Done.freeSelf))
|
||||
SynthDef(\pos_sin, {
|
||||
arg out, dur=1;
|
||||
Out.kr(out, EnvGen.kr(Env.sine(dur, 1), doneAction: Done.freeSelf))
|
||||
}).add();
|
||||
|
||||
SynthDef(\pos_reverse, {
|
||||
arg out, length=1;
|
||||
Out.kr(out, EnvGen.kr(Env([1, 0], length), doneAction: Done.freeSelf))
|
||||
arg out, dur=1;
|
||||
Out.kr(out, EnvGen.kr(Env([1, 0], dur), doneAction: Done.freeSelf))
|
||||
}).add();
|
||||
|
||||
// SynthDef(\pos_step, {
|
||||
|
@ -42,4 +42,3 @@ SynthDef(\metronome, {
|
|||
).add;
|
||||
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue