Fixed playback issues
parent
58117762a6
commit
4f4132fdcc
|
@ -4,9 +4,7 @@
|
||||||
~modes = [
|
~modes = [
|
||||||
[ "saw", \pos_saw ],
|
[ "saw", \pos_saw ],
|
||||||
[ "reverse", \pos_reverse ],
|
[ "reverse", \pos_reverse ],
|
||||||
[ "sine", \pos_sine ],
|
[ "sine", \pos_sine ]
|
||||||
[ "step", \pos_step ],
|
|
||||||
[ "random", \pos_random ]
|
|
||||||
];
|
];
|
||||||
|
|
||||||
~outputDir = Platform.recordingsDir +/+ "GrainBuffers";
|
~outputDir = Platform.recordingsDir +/+ "GrainBuffers";
|
||||||
|
@ -15,15 +13,16 @@
|
||||||
~grainsb = Bus.audio(s, 2);
|
~grainsb = Bus.audio(s, 2);
|
||||||
|
|
||||||
~granulators = Array.new(4);
|
~granulators = Array.new(4);
|
||||||
|
~grainmodes = [ 0, 0, 0, 0 ]; // keep track of mode so don't swap if not needed
|
||||||
~posb = Array.new(4);
|
~posb = Array.new(4);
|
||||||
~rectriggerb = Array.new(4);
|
~rectriggerb = Array.new(4);
|
||||||
~possynths = Array.new(4);
|
~patterns = Array.new(4);
|
||||||
~triggersynths = Array.new(4);
|
~players = Array.new(4);
|
||||||
|
~loopsynths = Array.new(4);
|
||||||
|
|
||||||
// create the control busses
|
// create the control busses
|
||||||
|
|
||||||
(0..3).do({
|
(0..3).do({
|
||||||
var ps;
|
|
||||||
~posb.add(Bus.control(s, 1));
|
~posb.add(Bus.control(s, 1));
|
||||||
~rectriggerb.add(Bus.control(s, 1));
|
~rectriggerb.add(Bus.control(s, 1));
|
||||||
});
|
});
|
||||||
|
@ -35,29 +34,49 @@
|
||||||
~granulators.add(Granulator.new(~buflen, ~infxb, ~grainsb, pb, rtb));
|
~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|
|
(0..3).do({ |i|
|
||||||
var pb = ~posb[i], rtb = ~rectriggerb[i];
|
~patterns.add(~makePattern.value(i, 0));
|
||||||
~possynths.add(Synth(\pos_saw, [ \out, pb, \speed, 1 / ~buflen ]));
|
|
||||||
~triggersynths.add(Synth(\trigger, [ \out, rtb, \freq, 1 / ~buflen ]));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO - retrigger the buffer records when changing the length etc
|
// play the four patterns
|
||||||
|
// to-do - will these need separate tempoclocks?
|
||||||
|
|
||||||
|
(0..3).do({|i|
|
||||||
|
~players.add(~patterns[i].play(~tc, quant: ~beatsperbar))
|
||||||
|
});
|
||||||
|
|
||||||
~setmode = {
|
~setmode = {
|
||||||
arg track, mode;
|
arg track, mode;
|
||||||
var synth = ~modes[mode][1];
|
if( ~grainmodes[track] != mode, {
|
||||||
~possynths[track].get(\speed, { | speed |
|
~grainmodes[track] = mode;
|
||||||
~possynths[track].free;
|
~players[track].stop;
|
||||||
~triggersynths[track].free;
|
~patterns[track].free;
|
||||||
~possynths[track] = Synth(synth, [\out, ~posb[track], \speed, speed]);
|
~patterns[track] = ~makePattern.value(track, mode);
|
||||||
~triggersynths[track] = Synth(\trigger, [ \out, ~rectriggerb[track] ]);
|
~players[track] = ~patterns[track].play(~tc, quant: ~beatsperbar);
|
||||||
});
|
});
|
||||||
~granulators[track].mode_(mode);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
~makePattern = {
|
||||||
|
arg track, mode;
|
||||||
|
var ptrig, ppos, synth = ~modes[mode][1];
|
||||||
|
[ "makePattern", ~track, ~buflen ].postln;
|
||||||
|
ptrig = Pbind(
|
||||||
|
\instrument, \trigger,
|
||||||
|
\dur, ~beatsperbar,
|
||||||
|
\out, ~rectriggerb[track]
|
||||||
|
);
|
||||||
|
ppos = Pbind(
|
||||||
|
\instrument, synth,
|
||||||
|
\dur, ~beatsperbar,
|
||||||
|
\length, ~buflen,
|
||||||
|
\out, ~posb[track]
|
||||||
|
);
|
||||||
|
Ppar([ptrig, ppos]);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
~dumpbuffers = { |prefix|
|
~dumpbuffers = { |prefix|
|
||||||
(0..3).do({|i|
|
(0..3).do({|i|
|
||||||
var filename = ~outputDir +/+ prefix ++ 'buffer' ++ i.asString ++ '.aiff';
|
var filename = ~outputDir +/+ prefix ++ 'buffer' ++ i.asString ++ '.aiff';
|
||||||
|
|
|
@ -85,10 +85,10 @@ OSCdef.freeAll;
|
||||||
~to.slider('/grains/buflen', ~buflen, TouchOSCScale(0.1, 10.0), {});
|
~to.slider('/grains/buflen', ~buflen, TouchOSCScale(0.1, 10.0), {});
|
||||||
|
|
||||||
|
|
||||||
// ~to.button('/grains/mode0', 0, { |v| ~granulators[0].mode_(v); ~setmode.value(0, v) });
|
~to.button('/grains/mode0', 0, { |v| ~setmode.value(0, v) });
|
||||||
// ~to.button('/grains/mode1', 0, { |v| ~granulators[1].mode_(v); ~setmode.value(1, v) });
|
~to.button('/grains/mode1', 0, { |v| ~setmode.value(1, v) });
|
||||||
// ~to.button('/grains/mode2', 0, { |v| ~granulators[2].mode_(v); ~setmode.value(2, v) });
|
~to.button('/grains/mode2', 0, { |v| ~setmode.value(2, v) });
|
||||||
// ~to.button('/grains/mode3', 0, { |v| ~granulators[3].mode_(v); ~setmode.value(3, v) });
|
~to.button('/grains/mode3', 0, { |v| ~setmode.value(3, v) });
|
||||||
//
|
//
|
||||||
// ~to.slider('/grains/speed0', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(0, 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/speed1', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(1, v) });
|
||||||
|
|
15
main.scd
15
main.scd
|
@ -32,24 +32,15 @@ Routine.run({
|
||||||
s.sync;
|
s.sync;
|
||||||
("./control.scd").loadRelative;
|
("./control.scd").loadRelative;
|
||||||
s.sync;
|
s.sync;
|
||||||
|
|
||||||
});
|
|
||||||
)
|
|
||||||
|
|
||||||
("./granulator.scd").loadRelative;
|
("./granulator.scd").loadRelative;
|
||||||
|
s.sync;
|
||||||
|
|
||||||
(
|
|
||||||
Routine.run({
|
|
||||||
("./effects.scd").loadRelative;
|
("./effects.scd").loadRelative;
|
||||||
s.sync;
|
s.sync;
|
||||||
("./sequencer.scd").loadRelative;
|
("./sequencer.scd").loadRelative;
|
||||||
s.sync;
|
s.sync;
|
||||||
|
~buflen.sleep;
|
||||||
|
"loading interface".postln;
|
||||||
("./interface.scd").loadRelative;
|
("./interface.scd").loadRelative;
|
||||||
});
|
});
|
||||||
)
|
)
|
||||||
|
|
||||||
~posb[0].scope
|
|
||||||
~granulators[0].grainamp_(0);
|
|
||||||
~granulators[0].loopsynth
|
|
||||||
~dumpbuffers.value("looptober23")
|
|
|
@ -2,14 +2,6 @@
|
||||||
(
|
(
|
||||||
|
|
||||||
|
|
||||||
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);
|
~metrob = Bus.audio(s, 2);
|
||||||
|
|
||||||
|
@ -21,7 +13,7 @@ SynthDef(\metronome, {
|
||||||
|
|
||||||
~metronome = Pbind(
|
~metronome = Pbind(
|
||||||
\instrument, \metronome,
|
\instrument, \metronome,
|
||||||
\dur, 1,
|
\dur, ~beatsperbar,
|
||||||
\amp, 0.5,
|
\amp, 0.5,
|
||||||
\pan, 0,
|
\pan, 0,
|
||||||
\out, ~metrob
|
\out, ~metrob
|
||||||
|
|
15
synths.scd
15
synths.scd
|
@ -1,18 +1,18 @@
|
||||||
(
|
(
|
||||||
|
|
||||||
SynthDef(\pos_saw, {
|
SynthDef(\pos_saw, {
|
||||||
arg out, dur=1;
|
arg out, length=1;
|
||||||
Out.kr(out, EnvGen.kr(Env([0, 1], dur), doneAction: Done.freeSelf))
|
Out.kr(out, EnvGen.kr(Env([0, 1], length), doneAction: Done.freeSelf))
|
||||||
}).add();
|
}).add();
|
||||||
|
|
||||||
SynthDef(\pos_sin, {
|
SynthDef(\pos_sine, {
|
||||||
arg out, dur=1;
|
arg out, length=1;
|
||||||
Out.kr(out, EnvGen.kr(Env.sine(dur, 1), doneAction: Done.freeSelf))
|
Out.kr(out, EnvGen.kr(Env.sine(length, 1), doneAction: Done.freeSelf))
|
||||||
}).add();
|
}).add();
|
||||||
|
|
||||||
SynthDef(\pos_reverse, {
|
SynthDef(\pos_reverse, {
|
||||||
arg out, dur=1;
|
arg out, length=1;
|
||||||
Out.kr(out, EnvGen.kr(Env([1, 0], dur), doneAction: Done.freeSelf))
|
Out.kr(out, EnvGen.kr(Env([1, 0], length), doneAction: Done.freeSelf))
|
||||||
}).add();
|
}).add();
|
||||||
|
|
||||||
// SynthDef(\pos_step, {
|
// SynthDef(\pos_step, {
|
||||||
|
@ -42,3 +42,4 @@ SynthDef(\metronome, {
|
||||||
).add;
|
).add;
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue