From e249d39f7f61c48aa6880ccb82a988a1bb886d25 Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Mon, 24 Apr 2023 15:54:24 +1000 Subject: [PATCH] Got server syncing working, moved granulator setup to its own file --- TODO.md | 44 +++++++++++++------------------- control.scd | 1 + effects.scd | 1 + granulator.scd | 40 +++++++++++++++++++++++++++++ main.scd | 68 +++++++++----------------------------------------- 5 files changed, 71 insertions(+), 83 deletions(-) create mode 100644 granulator.scd diff --git a/TODO.md b/TODO.md index 84d729b..af238f4 100644 --- a/TODO.md +++ b/TODO.md @@ -1,37 +1,27 @@ 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) - -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 \ No newline at end of file +more playback modes \ No newline at end of file diff --git a/control.scd b/control.scd index a0ae3ab..f130326 100644 --- a/control.scd +++ b/control.scd @@ -27,5 +27,6 @@ ~lfob = Synth(\lfo, [\out, ~lfobb ]); ~lfoc = Synth(\lfo, [\out, ~lfocb ]); +"LFOs running".postln; ) diff --git a/effects.scd b/effects.scd index fbd7e39..55a242c 100644 --- a/effects.scd +++ b/effects.scd @@ -70,4 +70,5 @@ } ).play(s, [ \in, ~delayb, \out, 0 ], \addToTail); +"Effects running".postln; ) diff --git a/granulator.scd b/granulator.scd new file mode 100644 index 0000000..7326b64 --- /dev/null +++ b/granulator.scd @@ -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; + +) \ No newline at end of file diff --git a/main.scd b/main.scd index e491e41..79ea333 100644 --- a/main.scd +++ b/main.scd @@ -2,70 +2,26 @@ ( Server.default.options.inDevice_("Scarlett 2i2 USB"); +Server.default.options.hardwareBufferSize_(1024); //Server.default.options.outDevice_("Scarlett 2i2 USB"); ) Server.killAll; - -("./synths.scd").loadRelative; -("./control.scd").loadRelative; -("./effects.scd").loadRelative; - -Granulator.init(s); - ( +Routine.run({ -~modes = [ - [ "saw", \pos_saw ], - [ "reverse", \pos_reverse ], - [ "sine", \pos_sine ], - [ "step", \pos_step ], - [ "random", \pos_random ] -]; + ("./synths.scd").loadRelative; + Granulator.init(s); -~granulators = Array.new(4); -~posb = Array.new(4); -~possynths = Array.new(4); + s.sync; -(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); + "Synths loaded".postln; + + ("./control.scd").loadRelative; + ("./effects.scd").loadRelative; + ("./granulator.scd").loadRelative; + s.sync; + ("./interface.scd").loadRelative; }); - - -(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) \ No newline at end of file