Last active
November 17, 2024 18:00
-
-
Save scztt/1acc0160b1d719e61ed0cfba11017c6a to your computer and use it in GitHub Desktop.
Revisions
-
scztt revised this gist
Nov 17, 2024 . 1 changed file with 11 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,8 +31,9 @@ Ndef(\synth, { sig, ClipNoise.ar, 1, (1 / (freq * LFDNoise3.ar([4, 2]).range(-0.1, 0.1).midiratio)), 4.2, 0.8 ); sig = sig + Pluck.ar( @@ -124,11 +125,11 @@ Ndef(\wild, { Ndef(\fastest, { [ LFDNoise3.ar(1).exprange(20, 3900), // lpf, 0.9, // res, LFDNoise3.ar(2).range(0.7, 13.6), // distort, LFDNoise3.ar(1/2).exprange(28, 295), // rate, LFDNoise3.ar(1/16).range(0.8, 1.1), // decay, ] }); @@ -154,11 +155,11 @@ Ndef(\synth).set( \freq, Ndef(\freq, { TChoose.kr( Dust.kr(4), 30 + [0, 2, 3, 7, 54] ) * TChoose.kr( Dust.kr(2), [0, 2, 4, 9] - 2 ).midiratio }) ); @@ -213,3 +214,4 @@ MIDIdef.cc(\midiDef_filterSpeed, { -
scztt revised this gist
Nov 17, 2024 . 1 changed file with 11 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ Ndef(\synth, { detune = [0, 1].resamp1(8) * env.linlin(0, 1, 0.001, 0.04); sig = 0.5 * Saw.ar(freq * detune.midiratio).sum; sig = env * sig; sig = RLPF.ar(sig, lpf, res); sig = (distort.linlin(0, 1, 1, 8) * sig).fold(-1.0, 1.0); @@ -39,10 +39,11 @@ Ndef(\synth, { sig, ClipNoise.ar, 1, ([3, 2] / 8) * LFDNoise3.ar(1/[4, 4]).range(-1, 1).midiratio, 5, 0.9 ); sig = LeakDC.ar(sig); sig * [1, 1] * amp; }).play; @@ -153,8 +154,12 @@ Ndef(\synth).set( \freq, Ndef(\freq, { TChoose.kr( Dust.kr(4), 30 + [0, 2, 3, 7, 54, 834] ) * TChoose.kr( Dust.kr(24), [0, 2, 4, 7] ).midiratio }) ); ) @@ -205,3 +210,6 @@ MIDIdef.cc(\midiDef_filterSpeed, { -
scztt revised this gist
Nov 17, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -138,7 +138,7 @@ Ndef(\fastest, { // 3: Set your "preset" Ndefs into synthControls. // It will slowly fade over to this depending on fadeTime. Ndef(\synthControls).fadeTime = 10; Ndef(\synthControls, Ndef(\basic)); // Ndef(\synthControls, Ndef(\fast)); // Ndef(\synthControls, Ndef(\fastChanging)); -
scztt revised this gist
Nov 17, 2024 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -136,9 +136,9 @@ Ndef(\fastest, { ( // 3: Set your "preset" Ndefs into synthControls. // It will slowly fade over to this depending on fadeTime. Ndef(\synthControls).fadeTime = 10; Ndef(\synthControls, Ndef(\fastest)); // Ndef(\synthControls, Ndef(\fast)); // Ndef(\synthControls, Ndef(\fastChanging)); -
scztt revised this gist
Nov 17, 2024 . 1 changed file with 14 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -62,18 +62,19 @@ Ndef(\synthControls).fadeTime = 10; // The order of the outputs of your control Ndefs should match this, e.g. // the first output should always be lpf. Ndef(\synth).set( \lpf, Ndef(\synthControls).bus.subBus(0).asMap, \res, Ndef(\synthControls).bus.subBus(1).asMap, \distort, Ndef(\synthControls).bus.subBus(2).asMap, \rate, Ndef(\synthControls).bus.subBus(3).asMap, \decay, Ndef(\synthControls).bus.subBus(4).asMap, ); // Breaking it down: // Ndef(\synthControls) ... the Ndef // .bus ... the Bus that this Ndef is sending to. This is 5 channels, as per above definition // .subBus ... we want to map just ONE channel of the 5 channel bus, so we use subBus to get 0..5 // .asMap ... We need this in order to MAP the bus to this control, otherwise we just set the control value once ) ( @@ -133,12 +134,16 @@ Ndef(\fastest, { ) ( // 3: Set your "preset" Ndefs into synthControls. // It will slowly fade over to this depending on fadeTime.&&(function, adverb) Ndef(\synthControls).fadeTime = 10; Ndef(\synthControls, Ndef(\basic)); // Ndef(\synthControls, Ndef(\fast)); // Ndef(\synthControls, Ndef(\fastChanging)); // Ndef(\synthControls, Ndef(\wild)); // Ndef(\synthControls, Ndef(\fastest)); ) ( @@ -151,7 +156,7 @@ Ndef(\synth).set( 30 + [0, 2, 3, 7, 54] ) }) ); ) ( @@ -198,3 +203,5 @@ MIDIdef.cc(\midiDef_filterSpeed, { -
scztt created this gist
Nov 17, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,200 @@ ( Ndef(\synth, { var lpf, res, distort, rate, decay, freq, amp, sig, env, trig, detune; // CONTROLS lpf = \lpf.ar(540); res = \res.ar(0.9); distort = \distort.ar(0.7); rate = \rate.kr(3); decay = (1 / rate) * \decay.ar(1.8); amp = \amp.kr(-24.dbamp); freq = \freq.kr(60); [lpf, res, distort, rate, decay].poll(1); // print out controls trig = Impulse.ar(rate); env = Env.perc(0, decay).ar(gate:trig); detune = [0, 1].resamp1(8) * env.linlin(0, 1, 0.001, 0.04); sig = 0.5 * Saw.ar(freq * detune.midiratio, ).sum; sig = env * sig; sig = RLPF.ar(sig, lpf, res); sig = (distort.linlin(0, 1, 1, 8) * sig).fold(-1.0, 1.0); sig = RLPF.ar(sig, lpf * 2, res); sig = sig + Pluck.ar( sig, ClipNoise.ar, 1, (1 / freq) * LFDNoise3.ar([4, 2]).range(-0.1, 0.1).midiratio, 4.2, 0.95 ); sig = sig + Pluck.ar( sig, ClipNoise.ar, 1, 1 / [3, 4] * LFDNoise3.ar(1/[4, 4]).range(-1, 1).midiratio, 5, 0.9 ); sig * [1, 1] * amp; }).play; ) ( // 1: Make an empty Ndef, with 5 channels bc we have 5 controls. Just output DC.ar(0), e.g. an audio // rate signal of 0. Ndef(\synthControls, { DC.ar(0) ! 5 }); // Fadetime controls how fast you fade between control settings Ndef(\synthControls).fadeTime = 10; // Map the outputs of synthControls to your \synth controls. // The order of the outputs of your control Ndefs should match this, e.g. // the first output should always be lpf. // Breaking it down: // Ndef(\synthControls) ... the Ndef // .bus ... the Bus that this Ndef is sending to. This is 5 channels, as per above definition // .subBus ... we want to map just ONE channel of the 5 channel bus, so we use subBus to get 0..5 // .asMap ... We need this in order to MAP the bus to this control, otherwise we just set the control value once Ndef(\synth).set( \lpf, Ndef(\synthControls).bus.subBus(0).asMap, \res, Ndef(\synthControls).bus.subBus(1).asMap, \distort, Ndef(\synthControls).bus.subBus(2).asMap, \rate, Ndef(\synthControls).bus.subBus(3).asMap, \decay, Ndef(\synthControls).bus.subBus(4).asMap, ); ) ( // 2: Define some preset control behaviors. They should output a list of signals, correponding to the // controls youre mapping above. Ndef(\basic, { [ 200, // lpf, 0.7, // res, 0.2, // distort, 1/2, // rate, 1, // decay, ] }); Ndef(\fast, { [ 300, // lpf, 0.7, // res, 0.2, // distort, 4, // rate, 1, // decay, ] }); Ndef(\fastChanging, { [ LFDNoise3.ar(1/8).range(200, 700), // lpf, 0.7, // res, LFDNoise3.ar(1/8).range(0.2, 0.6), // distort, 4, // rate, 1, // decay, ] }); Ndef(\wild, { [ LFDNoise3.ar(9).exprange(320, 4900), // lpf, 0.3, // res, LFDNoise3.ar(2).range(2, 3.6), // distort, TChoose.ar(Impulse.ar(2), DC.ar([1, 4, 2])), // rate, 2, // decay, ] }); Ndef(\fastest, { [ LFDNoise3.ar(1).exprange(320, 6900), // lpf, 0.4, // res, LFDNoise3.ar(2).range(0.7, 13.6), // distort, LFDNoise3.ar(1/2).exprange(8, 95), // rate, LFDNoise3.ar(1/16).range(0.1, 1.1), // decay, ] }); ) ( // 3: Set your "preset" Ndefs into synthControls. // It will slowly fade over to this depending on fadeTime.&&(function, adverb) Ndef(\synthControls).fadeTime = 10; Ndef(\synthControls, Ndef(\basic)); ) ( // 4: You can independently set other controls as well... // And, you can set inline defined ndefs directly as .set parameters Ndef(\synth).set( \freq, Ndef(\freq, { TChoose.kr( Dust.kr(4), 30 + [0, 2, 3, 7, 54] ) }) ) ) ( // Also, remember that your "preset" Ndefs can have controls as well, which you can use to // e.g. control with MIDI: Ndef(\wildMIDI, { // Make out midi controls take 0..1 numbers, and then remap with linlin linexp // bc its easier var lowpass = \lowpass.kr(0) .linexp(0, 1, 200, 5000) .lag(0.1); var filterSpeed = \filterSpeed.kr(0) .linlin(0, 1, 1, 9) .lag(0.1); [ LFDNoise3.ar(4).linexp( -1, 1, 120, lowpass ), // lpf, 0.3, // res, LFDNoise3.ar(2).range(2, 3.6), // distort, TChoose.ar(Impulse.ar(2), DC.ar([1, 4, 2])), // rate, 2, // decay, ] }); Ndef(\synthControls, Ndef(\wildMIDI)); Ndef(\wildMIDI).set(\lowpass, 0.3, \filterSpeed, 0.4); MIDIdef.cc(\midiDef_lowpass, { |value| Ndef(\wildMIDI).set(\lowpass, value / 127.0) }, 0); MIDIdef.cc(\midiDef_filterSpeed, { |value| Ndef(\wildMIDI).set(\filterSpeed, value / 127.0) }, 1) )