Got server syncing working, moved granulator setup to its own file

feature-multitrack
Mike Lynch 2023-04-24 15:54:24 +10:00
parent 4c5cc176f3
commit e249d39f7f
5 changed files with 71 additions and 83 deletions

44
TODO.md
View File

@ -1,37 +1,27 @@
TODO TODO
==== ====
## Basic interface stuff Monday-Tuesday to-do
Write default settings to the interface on startup <-- done Use server.sync to speed up booting
Try to get all the common interfaces on one page - re-route the effects so that it goes
input -> filter -> delay -> granulator -> reverb
not input -> granulator -> effects
Synchronise speeds across granulators
Quantise speeds
that's enough!
--
## Musical Later:
Test things like really rapid playback vibrato and tremolo
Pitch-shifting (tuned and untuned) more playback modes
LFO Modulate the filter <-- done
LFO Modulate the granulator settings
Separate panel for input effects: distort and overdrive
Sync timining of granule playback to buffer length / speed
Timing based on beat detection
## Advanced interface
Save current patch / load patch <-- Done
Save the current buffer! - if this is incorporated with current settings, it's a way to save how the granulator is playing, and then resume. Which is good for live stuff and also for overdubbing
SuperCollider seems to have the ability to read and write files, but not scan directories, so the patch-saver will have to maintain its own index file
patch = file with settings, including a link to the buffer sample

View File

@ -27,5 +27,6 @@
~lfob = Synth(\lfo, [\out, ~lfobb ]); ~lfob = Synth(\lfo, [\out, ~lfobb ]);
~lfoc = Synth(\lfo, [\out, ~lfocb ]); ~lfoc = Synth(\lfo, [\out, ~lfocb ]);
"LFOs running".postln;
) )

View File

@ -70,4 +70,5 @@
} }
).play(s, [ \in, ~delayb, \out, 0 ], \addToTail); ).play(s, [ \in, ~delayb, \out, 0 ], \addToTail);
"Effects running".postln;
) )

40
granulator.scd 100644
View File

@ -0,0 +1,40 @@
(
~modes = [
[ "saw", \pos_saw ],
[ "reverse", \pos_reverse ],
[ "sine", \pos_sine ],
[ "step", \pos_step ],
[ "random", \pos_random ]
];
~granulators = Array.new(4);
~posb = Array.new(4);
~possynths = Array.new(4);
(0..3).do({
var pb = Bus.control(s, 1), ps;
~posb.add(pb);
ps = Synth(\pos_saw, [ \out, pb, \speed, 1 / ~buflen ]);
~possynths.add(ps);
});
(0..3).do({ |i|
var pb = ~posb.at(i);
~granulators.add(Granulator.new(~buflen, ~recordb, ~fxb, pb, ~triggerb, ~pitchb));
});
~setmode = {
arg track, mode;
var synth = ~modes[mode][1];
~possynths[track].get(\speed, { | speed |
~possynths[track].free;
~possynths[track] = Synth(synth, [\out, ~posb[track], \speed, speed]);
});
~granulators[track].mode_(mode);
};
"Granulator running".postln;
)

View File

@ -2,70 +2,26 @@
( (
Server.default.options.inDevice_("Scarlett 2i2 USB"); Server.default.options.inDevice_("Scarlett 2i2 USB");
Server.default.options.hardwareBufferSize_(1024);
//Server.default.options.outDevice_("Scarlett 2i2 USB"); //Server.default.options.outDevice_("Scarlett 2i2 USB");
) )
Server.killAll; Server.killAll;
(
Routine.run({
("./synths.scd").loadRelative; ("./synths.scd").loadRelative;
("./control.scd").loadRelative;
("./effects.scd").loadRelative;
Granulator.init(s); Granulator.init(s);
( s.sync;
~modes = [ "Synths loaded".postln;
[ "saw", \pos_saw ],
[ "reverse", \pos_reverse ],
[ "sine", \pos_sine ],
[ "step", \pos_step ],
[ "random", \pos_random ]
];
~granulators = Array.new(4); ("./control.scd").loadRelative;
~posb = Array.new(4); ("./effects.scd").loadRelative;
~possynths = Array.new(4); ("./granulator.scd").loadRelative;
s.sync;
(0..3).do({ ("./interface.scd").loadRelative;
var pb = Bus.control(s, 1), ps;
~posb.add(pb);
ps = Synth(\pos_saw, [ \out, pb, \speed, 1 / ~buflen ]);
~possynths.add(ps);
}); });
(0..3).do({ |i|
var pb = ~posb.at(i);
~granulators.add(Granulator.new(~buflen, ~recordb, ~fxb, pb, ~triggerb, ~pitchb));
});
~setmode = {
arg track, mode;
var synth = ~modes[mode][1];
~possynths[track].get(\speed, { | speed |
~possynths[track].free;
~possynths[track] = Synth(synth, [\out, ~posb[track], \speed, speed]);
});
~granulators[track].mode_(mode);
}
) )
("./interface.scd").loadRelative;
~to.controls.keys.do({|k, i| i.postln; k.postln;~to.controls[k].postln});
~to.controls['/track/speed'].send_(0.1);
~to.v_(, 0);
~to.controls.at(~trackctrl.value('speed')).isNil.not
a = "string"
b = 'string'
a.asSymbol
~possynths[0].get(\speed, {|v| v.postln});
~possynths[0].set(\speed, 20 / ~buflen)