From 276780acc97594dd66c874ee5964f186810234d1 Mon Sep 17 00:00:00 2001 From: Eugene Petkevich Date: Thu, 26 May 2022 11:43:32 +0300 Subject: [PATCH] Add synthdefs / experiment with membrane --- startup.scd | 75 ++++++++- .../33.7.5.1-morning.scd" | 70 +++++++-- .../33.7.5.1-studio42jam.scd" | 148 ++++++++++++++++++ .../33.7.5.3-morning.scd" | 113 +++++++++++++ 4 files changed, 391 insertions(+), 15 deletions(-) create mode 100644 "\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.1-studio42jam.scd" create mode 100644 "\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.3-morning.scd" diff --git a/startup.scd b/startup.scd index 8379526..f24c01d 100644 --- a/startup.scd +++ b/startup.scd @@ -1,4 +1,4 @@ -( +// ==== Server setup //s.options.outDevice = "MA WFRIENDZ"; s.options.maxNodes = 128 * 1024; s.options.maxSynthDefs = 32 * 1024; @@ -9,7 +9,78 @@ s.options.numControlBusChannels = 256 * 1024; s.options.numInputBusChannels = 16; s.options.numOutputBusChannels = 16; +// ==== Midi setup MIDIClient.init; MIDIIn.connectAll; -) +// ==== Synths +// additive sin synth, sounds like metal +SynthDef(\leto, { |freq = 440, sustain = 1, amp=1, out=0| + var sig = 0; + var num = 26; + var partial = 0; + num.do({ + var pfact = ExpRand(1, 16); + partial = SinOsc.ar(freq * pfact, Rand(0, 2pi)) / num / pfact; + partial = partial * EnvGen.kr(Env.perc(0.03, Rand(sustain/5, sustain))); + partial = Pan2.ar(partial, Rand(-0.5, 0.5)); + sig = sig + partial; + }); + sig = sig * Line.kr(1, 1, sustain+0.1, doneAction: 2); + Out.ar(out, sig*amp); +}).add; + +// additive pulse synth +SynthDef(\pope, {|out=0, gate=1, freq=440, amp=1| + var sig = 0; + var num = 30; + num.do({ + sig = sig + (LFPulse.ar(freq, Rand(0, 0.01), SinOsc.kr(SinOsc.kr(Rand(2, 8), 0, 2, 2), Rand(0, 2pi), 0.5, 0.5)) / num); + }); + sig = sig * EnvGen.kr(Env.asr(0.03, 0.3, 1.8), gate, doneAction: Done.freeSelf); + sig = Pan2.ar(sig, Rand(-0.2, 0.2), amp); + Out.ar(out, sig); +}).add; + +// Subtract synth pad +SynthDef(\dyti, { + | out=0, gate=1, freq=440, amp=1, cut=800, rez=0.8, + modFreqMin=7, modFreqMax=12, modAmp=0.01, release=1.0 | + var sig = 0; + var modFreq = SinOsc.kr(Rand(modFreqMin, modFreqMax), 0, modAmp, 1); + sig = sig + Pulse.ar(freq * modFreq); + sig = RLPF.ar(sig, cut, rez); + sig = sig * EnvGen.ar(Env.asr(releaseTime: release), gate, doneAction: 2); + sig = Pan2.ar(sig, Rand(-0.3, 0.3)); + Out.ar(out, sig * amp); +}).add; + +// Subtract synth drum +SynthDef(\dytu, { + | out=0, sustain=0.5, freq=440, amp=1, cut=800, rez=0.8, + modFreqMin=7, modFreqMax=12, modAmp=0.01, release=1.0 | + var sig = 0; + var modFreq = SinOsc.kr(Rand(modFreqMin, modFreqMax), 0, modAmp, 1); + sig = sig + Pulse.ar(freq * modFreq); + sig = RLPF.ar(sig, cut, rez); + sig = sig * EnvGen.ar(Env.perc(0.005, releaseTime: release), doneAction: 2); + sig = Pan2.ar(sig, Rand(-0.3, 0.3)); + Out.ar(out, sig * amp); +}).add; + +// bass drum +SynthDef(\ruse, { | gate = 1, freq = 55, amp=1, out=0 | + var sig = AnalogBassDrum.ar( + gate, + infsustain: 1, + accent: 0.9, + freq: freq, + tone: 0.7, + decay: 0.15, + attackfm: 0.31, + selffm: 0.15, + ); + sig = sig * EnvGen.ar(Env.adsr(0.01, 0.2, 0.9, 0.25), gate, doneAction: 2); + sig = Pan2.ar(sig, 0); + Out.ar(out, sig * amp); +}).add; \ No newline at end of file diff --git "a/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.1-morning.scd" "b/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.1-morning.scd" index 78e1a0a..3aa9a22 100644 --- "a/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.1-morning.scd" +++ "b/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.1-morning.scd" @@ -2,7 +2,7 @@ SynthDef(\drum, {|out=0, amp=1, freq=110, sustain=1.0, attack=0.01, tension=0.01, loss=0.999999| var sig, env; - sig = SinOsc.ar(freq, mul: 0.5) + BrownNoise.ar(mul: 0.5); + sig = SinOsc.ar(freq, mul: 0.1) + BrownNoise.ar(mul: 0.5); env = Env.perc(attack, sustain-attack); sig = sig * EnvGen.ar(env, doneAction: 2); sig = MembraneCircle.ar(sig, tension, loss, mul: amp); @@ -11,18 +11,61 @@ SynthDef(\drum, {|out=0, amp=1, freq=110, }).add; ) +( +SynthDef(\membrane, {|out=0, amp=1, t_trig=0, tension=0.05, loss=0.99999| + var sig, excitation; + excitation = EnvGen.kr(Env.perc, t_trig, timeScale: 0.1, doneAction: 0); + excitation = excitation * PinkNoise.ar(); + sig = MembraneCircle.ar(excitation, tension, loss, mul: amp); + //sig = FreeVerb.ar(sig, 0.5, 0.2, 0.7); + sig = sig + (JPverb.ar(sig) * 0.2); + sig = Pan2.ar(sig, Rand(-0.3, 0.3)); + Out.ar(out, sig); +}).add; +) + +~m.free; +~m = Synth(\membrane); + +~m.set(\t_trig, 1); + +TempoClock.tempo = 2; + ( Pdef(\ritm, Pbind(*[ - instrument: \drum, - dur: 1, - db: -30, - //octave: 3, - //note: 0, - freq: 50, - legato: 2, - tension: 0.03, - loss: 0.9999, -])).quant_(1).stop; + type: \set, + id: ~m.nodeID, + \args, #[\t_trig, \tension, \loss, \amp], + dur: Pwrand([ + Pseq([1, 1, 1, 1].normalizeSum*4, 1), + Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum*4, 1), + Pseq([2, 2, 1, 1, 1, 1].normalizeSum*4, 1), + Pseq([4, 2, 2, 2, 2, 1, 1, 1, 1].normalizeSum*4, 1), + Pseq([3, 3, 2, 3, 2, 3].normalizeSum*4, 1), + Pseq([3, 3, 2, 2, 3, 3].normalizeSum*4, 1), + Pseq([3, 3, 2, 3, 3, 2].normalizeSum*4, 1), + Pseq([2, 1, 2, 1, 4, 2, 2, 2].normalizeSum*4, 1), + Pseq([3, 3, 2, 2, 1, 1, 1/2, 1/2, 1/2, 1/2, 2].normalizeSum*4, 1), + ], [5, 2, 1, 1, 2, 2, 2, 1, 1].normalizeSum, inf), + db: -20, + t_trig: Pwrand([1, 0], [15, 1], inf), + tension: 0.006/(Pkey(\dur)**0.4)*Pwhite(0.95, 1.05), + loss: Plprand(0.9999, 0.99995, inf), +])).quant_(4).play; +) + +( +Pdef(\ritmbase, Pbind(*[ + type: \set, + id: ~m.nodeID, + \args, #[\t_trig, \tension, \loss, \amp], + dur: Pseq([1, 1, 1, 1].normalizeSum*4, inf), + db: -25, + t_trig: 1, + tension: 0.004, + loss: 0.99995, + timingOffset: 0.01, +])).quant_(4).stop; ) ( @@ -32,6 +75,7 @@ Pdef(\ritm, Pbind(*[ ) * PinkNoise.ar(0.4); var tension = MouseX.kr(0.01, 0.1); var loss = MouseY.kr(0.999999, 0.999, 1); - MembraneCircle.ar(excitation, tension, loss); + MembraneCircle.ar(excitation, tension, loss)!2; }.play; -) \ No newline at end of file +) + diff --git "a/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.1-studio42jam.scd" "b/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.1-studio42jam.scd" new file mode 100644 index 0000000..aed81aa --- /dev/null +++ "b/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.1-studio42jam.scd" @@ -0,0 +1,148 @@ +( +SynthDef(\sisudi, {|out=0, gate=1, freq=440, amp=1, cut=800, rez=0.8, + modFreqMin=7, modFreqMax=12, modAmp=0.01, release=1.0| + var sig = 0; + var modFreq = SinOsc.kr(Rand(modFreqMin, modFreqMax), 0, modAmp, 1); + sig = sig + Pulse.ar(freq * modFreq); + sig = RLPF.ar(sig, cut.lag(0.01), rez.lag(0.01)); + sig = sig * EnvGen.ar(Env.asr(releaseTime: release), gate, doneAction: 2); + sig = Pan2.ar(sig, Rand(-0.3, 0.3)); + Out.ar(out, sig * amp); +}).add; + +SynthDef(\sileto, { |freq = 440, sustain = 1, amp=1, out=0| + var sig = 0; + var num = 26; + var partial = 0; + num.do({ + var pfact = ExpRand(1, 16); + partial = SinOsc.ar(freq * pfact, Rand(0, 2pi)) / num / pfact; + partial = partial * EnvGen.kr(Env.perc(0.03, Rand(sustain/5, sustain))); + partial = Pan2.ar(partial, Rand(-0.5, 0.5)); + sig = sig + partial; + }); + sig = sig * Line.kr(1, 1, sustain+0.1, doneAction: 2); + Out.ar(out, sig*amp); +}).add; + +SynthDef(\sipope, {|out=0, gate=1, freq=440, amp=1| + var sig = 0; + var num = 30; + num.do({ + sig = sig + (LFPulse.ar(freq, Rand(0, 0.01), SinOsc.kr(SinOsc.kr(Rand(2, 8), 0, 2, 2), Rand(0, 2pi), 0.5, 0.5)) / num); + }); + sig = sig * EnvGen.kr(Env.asr(0.03, 0.3, 1.8), gate, doneAction: Done.freeSelf); + sig = Pan2.ar(sig, Rand(-0.2, 0.2), amp); + Out.ar(out, sig); +}).add; +) + +~mix = MidiMix(); + +( +~mix.rot1_{|v| + TempoClock.tempo = TempoClock.tempo * (1.01**v); + TempoClock.tempo.postln; +}; +) + +TempoClock.tempo = 89 / 60; + +~necoGr = Group.new(); + +~efGr = Group.new(addAction: \addToTail); + +~efBus = Bus.audio(numChannels: 2); + +( +Pdef(\neco, Pbind(*[ + instrument: \sisudi, + db: Pwhite(-20, -15, inf)-26, + octave: Prand([2, 3, 4], inf), + note: Pxrand([0, 4, 9], inf), + legato: 0.4, + dur: Prand([1, 2, 3, 4]/4, inf), + timingOffset: 0.0, + group: ~necoGr, +])).quant_(4).stop; +) + +( +Pdef(\dodi, Pbind(*[ + instrument: \sileto, + db: Pwhite(-20, -15, inf), + octave: Prand([2, 3, 4], inf), + note: Pxrand([0, 4, 9], inf), + legato: 0.7, + dur: Prand([1], inf), + timingOffset: 0.5, + group: ~necoGr, + out: ~efBus, +])).quant_(4).stop; +) + +( +Pdef(\nadi, Pbind(*[ + instrument: \sipope, + db: Pwhite(-20, -15, inf)-10, + octave: Prand([2, 3, 4], inf), + note: Pxrand([0, 4, 9], inf), + legato: Pwhite(0.2, 0.8), + dur: Prand([1, 2, 3, 4, 6]/2, inf), + timingOffset: 0, + group: ~necoGr, + out: ~efBus, +])).quant_(4).stop; +) + +( +SynthDef(\reverb, { | amp=1, in, out=0, mix=0.33, t60= 1.0, damp= 0.0, size= 1.0, earlyDiff= 0.707, modDepth= 0.1, modFreq= 2.0, low= 1.0, mid= 1.0, high= 1.0, lowcut= 500.0, highcut= 2000.0 | + var sig, rev; + sig = In.ar(in, 2); + rev = JPverb.ar(sig, t60, damp, size, earlyDiff, modDepth, modFreq, low, mid, high, lowcut, highcut); + sig = sig + (rev*mix); + Out.ar(out, sig*amp); +}).add; +) + +~reverb = Synth(\reverb, [in: ~efBus], ~efGr); +~reverb.free; + +( +~mix.again_{|v| + ~reverb.set(\mix, v); + v.postln; +}; +) + +( +SynthDef(\siruse, { | gate = 1, freq = 55, amp=1, out=0 | + var sig = AnalogBassDrum.ar( + gate, + infsustain: 1, + accent: 0.9, + freq: freq, + tone: 0.7, + decay: 0.15, + attackfm: 0.31, + selffm: 0.15, + ); + sig = sig * EnvGen.ar(Env.adsr(0.01, 0.2, 0.9, 0.25), gate, doneAction: 2); + sig = Pan2.ar(sig, 0); + Out.ar(out, sig * amp); +}).add; +) + +( +Pdef(\paketo, Pbind( + \instrument, Pseq([\siruse], inf), + \octave, [2, 3, 4], + \note, Pxrand([0, 2], inf), + \dur, Pseq([3, 3, 2].normalizeSum, inf), + \timingOffset, [0, 1/5, 2/5], + \legato, [1, 4/5, 3/5]*0.2, + \db, Pseq([-2], inf), + \out, ~efBus, + \group, ~necoGr, +)).quant_(1).stop; +) \ No newline at end of file diff --git "a/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.3-morning.scd" "b/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.3-morning.scd" new file mode 100644 index 0000000..d8f0ed7 --- /dev/null +++ "b/\320\245\321\215\320\267\320\270\321\204\321\203/33.7.5.3-morning.scd" @@ -0,0 +1,113 @@ +TempoClock.tempo = 1; + +( +Pdef(\bass1, Pbind(*[ + instrument: \dytu, + release: 2.0, + dur: 1 * 2, + db: -12, + octave: 2, + cut: 200, + rez: 0.9, + note: Pseq([4, 4, 7], inf), +])).quant_(3).stop; +) + +( +Pdef(\bass2, Pbind(*[ + instrument: \dytu, + release: 1.0, + dur: Pseq([2, 1, 1, 2].normalizeSum * 3, inf), + db: -12, + octave: 3, + note: Pseq([4, 9, 5, 4], inf), + cut: 400, + rez: 0.9, +])).quant_(3).stop; +) + +( +Pdef(\mid1, Pbind(*[ + instrument: \dytu, + release: Pseq([0.6, 0.7, 1.0], inf), + dur: Pseq([2, 3, 3].normalizeSum * 3, inf), + db: -14, + octave: 4, + note: Pseq([9, 4, 0], inf), + cut: 600, + rez: 0.7, +])).quant_(3).stop; +) + +( +Pdef(\mid2, Pbind(*[ + instrument: \dyti, + release: 0.3, + legato: 0.5, + dur: Pseq([1, 1+(1/9), 1-(1/9)], inf), + db: -27, + octave: 5, + note: Pseq([2, 2, 4, 4, 4, 2, 2, 2, 4, 9, 7, 2], inf), + cut: 800, + rez: 0.6, +])).quant_(3).stop; +) + +( +Pdef(\mid3, Pbind(*[ + instrument: \dyti, + release: 0.9, + legato: 0.1, + dur: Pseq([3, 3, 1, 3, 2].normalizeSum * 3 / 2, inf), + db: -30, + octave: 6, + note: Pxrand([2, 4, 5, 7], inf), + cut: 1000, + rez: 0.5, +])).quant_(3).stop; +) + +( +Pdef(\hi1, Pbind(*[ + instrument: \dytu, + release: Pwhite(0.2, 0.4, inf), + dur: Pseq([2, 2, 1, 3].normalizeSum * 3 / 8, inf), + strum: 1/27, + db: -41, + octave: 7, + note: Pxrand([2, 4, 5, 7], inf) + [0, 2, 5], + cut: 1200, + rez: 0.4, +])).quant_(3).stop; +) + +( +Pdef(\hi2, Pbind(*[ + instrument: \dyti, + release: 0.3, + legato: 0.9, + dur: Pseq([2, 1, 2, 1].normalizeSum * 3, inf), + db: -42, + octave: 8, + note: Pxrand([0, 5, 7, 9], inf), + cut: 1400, + rez: 0.4, +])).quant_(3).stop; +) + +( +Pdef(\hi3, Pbind(*[ + instrument: \dyti, + release: 0.1, + legato: 0.5, + dur: Pseq([2, 1, 2, 1].normalizeSum * 3 / 4, inf), + db: -31, + octave: 9, + note: Pxrand([0, 5, 7, 9], inf), + cut: 1600, + rez: 0.3, +])).quant_(3).stop; +) + + + -- 2.17.1