diff --git a/SYNTH_DESIGN.md b/SYNTH_DESIGN.md index c962564825..b9aa019de1 100644 --- a/SYNTH_DESIGN.md +++ b/SYNTH_DESIGN.md @@ -264,4 +264,6 @@ Some final notes: - It is perfectly possible to play the standards synths with a MIDI keyboard. Using gated synths is a bit more straightforward, e. g. when trying to get the synth to use the release phase as selected with the `release:` parameter. Look for "MIDI keyboard" on [in-thread](https://in-thread.sonic-pi.net/) for examples of how a MIDI keyboard handler can be made, with or without gated synths. -- Some synths have been left out on purpose. The `:dull_bell` and `:pretty_bell` synths depend on the interrelations of the envelopes of their partials and no reasonable way of adding a gate parameter was found. Also, merely percussive synths like the SC808 group of synths were not enabled to be used with a gate. \ No newline at end of file +- Some synths have been left out on purpose. The `:dull_bell` and `:pretty_bell` synths depend on the interrelations of the envelopes of their partials and no reasonable way of adding a gate parameter was found. Also, merely percussive synths like the SC808 group of synths were not enabled to be used with a gate. + +- On some synths, e. g. `:kalimba` it is necessary to reduce the default `:release` in order for the gate to take effect. \ No newline at end of file diff --git a/etc/synthdefs/compiled/gated/sonic-pi-bass_foundation_gated.scsyndef b/etc/synthdefs/compiled/gated/sonic-pi-bass_foundation_gated.scsyndef new file mode 100644 index 0000000000..f394b332f2 Binary files /dev/null and b/etc/synthdefs/compiled/gated/sonic-pi-bass_foundation_gated.scsyndef differ diff --git a/etc/synthdefs/compiled/gated/sonic-pi-bass_highend_gated.scsyndef b/etc/synthdefs/compiled/gated/sonic-pi-bass_highend_gated.scsyndef new file mode 100644 index 0000000000..3ecb23f0b0 Binary files /dev/null and b/etc/synthdefs/compiled/gated/sonic-pi-bass_highend_gated.scsyndef differ diff --git a/etc/synthdefs/compiled/gated/sonic-pi-gabberkick_gated.scsyndef b/etc/synthdefs/compiled/gated/sonic-pi-gabberkick_gated.scsyndef new file mode 100644 index 0000000000..9fb93f69c1 Binary files /dev/null and b/etc/synthdefs/compiled/gated/sonic-pi-gabberkick_gated.scsyndef differ diff --git a/etc/synthdefs/compiled/gated/sonic-pi-kalimba_gated.scsyndef b/etc/synthdefs/compiled/gated/sonic-pi-kalimba_gated.scsyndef new file mode 100644 index 0000000000..6d6ab10117 Binary files /dev/null and b/etc/synthdefs/compiled/gated/sonic-pi-kalimba_gated.scsyndef differ diff --git a/etc/synthdefs/compiled/gated/sonic-pi-rodeo_gated.scsyndef b/etc/synthdefs/compiled/gated/sonic-pi-rodeo_gated.scsyndef new file mode 100644 index 0000000000..2159df6a22 Binary files /dev/null and b/etc/synthdefs/compiled/gated/sonic-pi-rodeo_gated.scsyndef differ diff --git a/etc/synthdefs/designs/supercollider/gated/bass_foundation_gated.scd b/etc/synthdefs/designs/supercollider/gated/bass_foundation_gated.scd new file mode 100644 index 0000000000..38305630f8 --- /dev/null +++ b/etc/synthdefs/designs/supercollider/gated/bass_foundation_gated.scd @@ -0,0 +1,51 @@ +// Adapted for Sonic Pi from +// https://raw.githubusercontent.com/supercollider/supercollider/develop/examples/demonstrations/stealthissound.scd +// Published there under GPL v3, so re-published under the same terms, see: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// Date of modification: 10.01.2021 + +( +SynthDef('sonic-pi-bass_foundation_gated', {| + note = 40, note_slide = 0, note_slide_shape = 1, note_slide_curve = 0, + amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0, + pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0, + attack = 0, decay = 0, sustain = 0, release = 1, + attack_level = 1, decay_level = -1, sustain_level = 1, + cutoff = 83, cutoff_slide = 0, cutoff_slide_shape = 1, cutoff_slide_curve = 0, + res = 0.5, res_slide = 0, res_slide_shape = 1, res_slide_curve = 0, + + gate = 1, + + out_bus = 0| + + var snd, osc, env, filterenv; + + note = note.midicps; + note = note.varlag(note_slide, note_slide_curve, note_slide_shape); + decay_level = Select.kr(decay_level < 0, [decay_level, sustain_level]); + amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape); + pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape); + + cutoff = cutoff.midicps; + cutoff = cutoff.varlag(cutoff_slide, cutoff_slide_curve, cutoff_slide_shape); + + res = res.linlin(0, 1, 1, 0); + res = res.varlag(res_slide, res_slide_curve, res_slide_shape); + + osc = Saw.ar(note); + + filterenv = EnvGen.ar(Env.adsr(0.0, 0.5, 0.2, 0.2), 1, doneAction:2); + snd = RLPF.ar(osc,cutoff*filterenv+100, res); + + env = Env.new( + [0, attack_level, decay_level, sustain_level, 0], + [attack,decay,sustain,release], + \lin, + 3 + ); + + snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, gate, doneAction: 2), pan); + + Out.ar(out_bus, snd * amp); +}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/"); +) \ No newline at end of file diff --git a/etc/synthdefs/designs/supercollider/gated/bass_highend_gated.scd b/etc/synthdefs/designs/supercollider/gated/bass_highend_gated.scd new file mode 100644 index 0000000000..777898a085 --- /dev/null +++ b/etc/synthdefs/designs/supercollider/gated/bass_highend_gated.scd @@ -0,0 +1,63 @@ +// Adapted for Sonic Pi from +// https://raw.githubusercontent.com/supercollider/supercollider/develop/examples/demonstrations/stealthissound.scd +// Published there under GPL v3, so re-published under the same terms, see: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// Date of modification: 11.01.2021 + +( +SynthDef('sonic-pi-bass_highend_gated',{| + note = 40, note_slide = 0, note_slide_shape = 1, note_slide_curve = 0, + amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0, + pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0, + attack = 0, decay = 0, sustain = 0, release = 1, + attack_level = 1, decay_level = -1, sustain_level = 1, + cutoff = 102, cutoff_slide = 0, cutoff_slide_shape = 1, cutoff_slide_curve = 0, + res = 0.9, res_slide = 0, res_slide_shape = 1, res_slide_curve = 0, + drive = 2.0, drive_slide = 0, drive_slide_shape = 1, drive_slide_curve = 0, + + gate = 1, + + out_bus = 0| + + var osc, snd, env, filterenv, ab; + + note = note.midicps; + note = note.varlag(note_slide, note_slide_curve, note_slide_shape); + decay_level = Select.kr(decay_level < 0, [decay_level, sustain_level]); + amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape); + pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape); + + cutoff = cutoff.midicps; + cutoff = cutoff.varlag(cutoff_slide, cutoff_slide_curve, cutoff_slide_shape); + + res = res.linlin(0, 1, 1, 0); + res = res.varlag(res_slide, res_slide_curve, res_slide_shape); + + drive = drive.varlag(drive_slide, drive_slide_curve, drive_slide_shape); + + osc = Mix(Saw.ar(note*[0.25,1,1.5],[0.5,0.4,0.1])); + filterenv = EnvGen.ar(Env.adsr(0.0,0.5,0.2,0.2), doneAction:2); + snd = RLPF.ar(osc,cutoff*filterenv+100,res); + + ab = abs(snd); + snd = (snd*(ab + drive)/(snd ** 2 + (drive - 1) * ab + 1)); + + // Remove low end + snd = BLowShelf.ar(snd, 300, 1.0, -12); + + // Dip at 1600Hz + snd = BPeakEQ.ar(snd, 1600, 1.0, -6); + + env = Env.new( + [0, attack_level, decay_level, sustain_level, 0], + [attack,decay,sustain,release], + \lin, + 3 + ); + + snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, gate, doneAction: 2) * 2, pan); + + Out.ar(out_bus, snd * amp); + +}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/"); +) \ No newline at end of file diff --git a/etc/synthdefs/designs/supercollider/gated/gabberkick_gated.scd b/etc/synthdefs/designs/supercollider/gated/gabberkick_gated.scd new file mode 100644 index 0000000000..dc44542a72 --- /dev/null +++ b/etc/synthdefs/designs/supercollider/gated/gabberkick_gated.scd @@ -0,0 +1,70 @@ +/* +Adapted port of snappizz gabberkick synthesizer, taken from here: + + https://sccode.org/1-57r gabber kick +*/ + +( +SynthDef('sonic-pi-gabberkick_gated', {| + note = 34, + amp = 0.5, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0, + pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0, + attack = 0.001, decay = 0.01, sustain = 0.3, release = 0.02, + attack_level = 1, decay_level = 0.7, sustain_level = 0.7, + + slope_start = 84, slope_length1 = 0.015, + slope_intermediate = 69, slope_length2 = 0.1, + boost = 8, boost_slide = 0, boost_slide_shape = 1, boost_slide_curve = 0, + + cutoff = 119, cutoff_slide = 0, cutoff_slide_shape = 1, cutoff_slide_curve = 0, + res = 0.2, res_slide = 0, res_slide_shape = 1, res_slide_curve = 0, + + gate = 1, + + out_bus = 0| + + var snd, env; + + note = note.midicps; + decay_level = Select.kr(decay_level < 0, [decay_level, sustain_level]); + amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape); + pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape); + + cutoff = cutoff.midicps; + cutoff = cutoff.varlag(cutoff_slide, cutoff_slide_curve, cutoff_slide_shape); + + slope_start = slope_start.midicps; + slope_intermediate = slope_intermediate.midicps; + + res = res.linlin(0, 1, 1, 0); + res = res.varlag(res_slide, res_slide_curve, res_slide_shape); + + boost = boost.varlag(boost_slide, boost_slide_curve, boost_slide_shape); + + snd = SinOsc.ar( + Env( + [slope_start, slope_intermediate, note], + [slope_length1, slope_length2], + \exp + ).ar * [-0.1, 0, 0.1].midiratio); + + snd = Mix(snd); + snd = (snd * 10).tanh; + snd = (snd * 5.1).atan; + snd = BPeakEQ.ar(snd, XLine.kr(2000, 100, 0.3), 2.0, boost); + snd = snd + DelayC.ar(snd, 0.01, SinOsc.ar(4).range(0.0, 0.001)); + snd = RLPF.ar(snd, cutoff, res); + snd = ((snd * 0.6).clip(-1, 1)); + + env = Env.new( + [0, attack_level, decay_level, sustain_level, 0], + [attack,decay,0,release], + \lin, + 3 + ); + + snd = Pan2.ar(snd * EnvGen.kr(env, gate, doneAction: 2), pan); + Out.ar(out_bus, snd * amp * 0.5); + +}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/"); +) \ No newline at end of file diff --git a/etc/synthdefs/designs/supercollider/gated/kalimba_gated.scd b/etc/synthdefs/designs/supercollider/gated/kalimba_gated.scd new file mode 100644 index 0000000000..88eac509c9 --- /dev/null +++ b/etc/synthdefs/designs/supercollider/gated/kalimba_gated.scd @@ -0,0 +1,54 @@ +// Adapted from http://sccode.org/1-51n +( +SynthDef('sonic-pi-kalimba_gated', {| + note = 52, note_slide = 0, note_slide_shape = 1, note_slide_curve = 0, + amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0, + pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0, + attack = 0, decay = 0, sustain = 0, release = 1, + attack_level = 1, decay_level = -1, sustain_level = 1, + clickiness = 0.1, + + gate = 1, + + out_bus = 0| + + var freq, snd, click, env; + + + note = note.midicps; + note = note.varlag(note_slide, note_slide_curve, note_slide_shape); + decay_level = Select.kr(decay_level < 0, [decay_level, sustain_level]); + amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape); + pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape); + + freq = note; + + // Basic tone is a SinOsc + snd = SinOsc.ar(freq) * EnvGen.ar(Env.perc(0.03, Rand(3.0, 4.0), 1, -7), doneAction: 2); + snd = HPF.ar( LPF.ar(snd, 380), 120); + // The "clicking" sounds are modeled with a bank of resonators excited by enveloped white noise + click = DynKlank.ar(`[ + // the resonant frequencies are randomized a little to add variation + // there are two high resonant freqs and one quiet "bass" freq to give it some depth + [240*ExpRand(0.97, 1.02), 2020*ExpRand(0.97, 1.02), 3151*ExpRand(0.97, 1.02)], + [-9, 0, -5].dbamp, + [0.8, 0.07, 0.08] + ], BPF.ar(PinkNoise.ar, 6500, 0.1) * EnvGen.ar(Env.perc(0.001, 0.01))) * clickiness; + snd = (snd*clickiness) + (click*(1-clickiness)); + + env = Env.new( + levels: [0, attack_level, decay_level, sustain_level, 0], + times: [attack, decay, sustain, release], + curve: \lin, + releaseNode: 3 + ); + + snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, gate, doneAction: 2), pan); + + Out.ar(out_bus, snd * amp); +}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/"); +) + +// .writeDefFile("/Users/xavierriley/Projects/sonic-pi/etc/synthdefs/compiled/"); +// use .add instead of .writeDefFile to test with the following: +// Synth('sonic-pi-kalimba', [note: 60, amp: 5, pan: 0, clickiness: 0.7]); \ No newline at end of file diff --git a/etc/synthdefs/designs/supercollider/gated/rhodey_gated.scd b/etc/synthdefs/designs/supercollider/gated/rhodey_gated.scd index fb7a64bb0d..b3da55ca20 100644 --- a/etc/synthdefs/designs/supercollider/gated/rhodey_gated.scd +++ b/etc/synthdefs/designs/supercollider/gated/rhodey_gated.scd @@ -80,6 +80,5 @@ SynthDef('sonic-pi-rhodey_gated', { snd = Pan2.ar(snd, pan, amp); Out.ar(out_bus, snd); -// }).play; - }).writeDefFile("/home/bmarx/music/sonic_pi/synthdefs/compiled/"); +}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/"); ) \ No newline at end of file diff --git a/etc/synthdefs/designs/supercollider/gated/rodeo_gated.scd b/etc/synthdefs/designs/supercollider/gated/rodeo_gated.scd new file mode 100644 index 0000000000..b5186c5704 --- /dev/null +++ b/etc/synthdefs/designs/supercollider/gated/rodeo_gated.scd @@ -0,0 +1,64 @@ +# Adapted from https://github.com/everythingwillbetakenaway/Synthdefs/blob/master/everythingrhodes.scd +( + SynthDef('sonic-pi-rodeo_gated',{| + note = 52, note_slide = 0, note_slide_shape = 1, note_slide_curve = 0, + amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0, + pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0, + attack = 0, decay = 0, sustain = 0, release = 1, + attack_level = 1, decay_level = -1, sustain_level = 1, + cutoff = 95, cutoff_slide = 0, cutoff_slide_shape = 1, cutoff_slide_curve = 1, + + gate=1, + + rq=0.5, + + use_chorus=0, use_compressor=0, amp_scale = 0.1, + + out_bus = 0| + + var snd, filter, filter_env, env, chorus; + + note = note.midicps; + note = note.varlag(note_slide, note_slide_curve, note_slide_shape); + decay_level = Select.kr(decay_level < 0, [decay_level, sustain_level]); + amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape); + pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape); + cutoff = cutoff.midicps; + cutoff = cutoff.varlag(cutoff_slide, cutoff_slide_curve, cutoff_slide_shape); + + snd = Pulse.ar(note*[1,33.5.midiratio],[0.2,0.1],[0.7,0.3]); + + filter_env = EnvGen.ar(Env.adsr(0.0, 1.0, 0.8, 3.0), gate, doneAction:2); + + //keyboard tracking filter cutoff + snd = BLowPass4.ar(snd,(cutoff * (filter_env.squared)) + 200 + note, rq); + + chorus = Select.ar(use_chorus, + [ + snd, + Splay.ar(Array.fill(4,{ + var maxdelaytime= rrand(0.005,0.02); + + DelayC.ar(snd[0], maxdelaytime,LFNoise1.kr(Rand(0.1,0.6),0.25*maxdelaytime,0.75*maxdelaytime) ) + })) + ]); + + snd = Select.ar(use_compressor, + [ + snd, + Compander.ar(2*(snd + chorus),snd*amp_scale,0.4,1,4) + ]); + + env = Env.new( + levels: [0, attack_level, decay_level, sustain_level, 0], + times: [attack, decay, sustain, release], + curve: \lin, + releaseNode: 3 + ); + + snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, gate, doneAction: 2), pan); + + Out.ar(out_bus, snd * amp); + +}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/"); +); diff --git a/etc/synthdefs/designs/supercollider/gated/winwood_lead_gated.scd b/etc/synthdefs/designs/supercollider/gated/winwood_lead_gated.scd new file mode 100644 index 0000000000..cdc196c19c --- /dev/null +++ b/etc/synthdefs/designs/supercollider/gated/winwood_lead_gated.scd @@ -0,0 +1,67 @@ +// Adapted for Sonic Pi from +// https://raw.githubusercontent.com/supercollider/supercollider/develop/examples/demonstrations/stealthissound.scd +// Published there under GPL v3, so re-published under the same terms, see: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// Date of modification: 27.12.2021, 21.02.2022 + +( +SynthDef('sonic-pi-winwood_lead_gated', {| + note = 69, note_slide = 0, note_slide_shape = 1, note_slide_curve = 0, + amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0, + pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0, + attack = 0, decay = 0, sustain = 0, release = 1, + attack_level = 1, decay_level = -1, sustain_level = 1, + cutoff = 119, cutoff_slide = 0, cutoff_slide_shape = 1, cutoff_slide_curve = 0, + lfo_width = 0.01, lfo_width_slide = 0, lfo_width_slide_shape = 1, lfo_width_slide_curve = 0, + lfo_rate = 8, lfo_rate_slide = 0, lfo_rate_slide_shape = 1, lfo_rate_slide_curve = 0, + res = 0.2, res_slide = 0, res_slide_shape = 1, res_slide_curve = 0, + ramp_ratio = 0.5, ramp_length = 0.2, + seed = 0, rand_buf = 0, + gate = 1, + out_bus = 0| + + var snd, pulse, env, lfo, ramp_env; + var rand_val; + + note = note.midicps; + note = note.varlag(note_slide, note_slide_curve, note_slide_shape); + decay_level = Select.kr(decay_level < 0, [decay_level, sustain_level]); + amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape); + pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape); + + cutoff = cutoff.midicps; + cutoff = cutoff.varlag(cutoff_slide, cutoff_slide_curve, cutoff_slide_shape); + + lfo_width = lfo_width.varlag(lfo_width_slide, lfo_width_slide_curve, lfo_width_slide_shape); + lfo_rate = lfo_rate.varlag(lfo_rate_slide, lfo_rate_slide_curve, lfo_rate_slide_shape); + + res = res.linlin(0, 1, 1, 0); + res = res.varlag(res_slide, res_slide_curve, res_slide_shape); + + rand_val = BufRd.kr(1, rand_buf, seed, 1); + + lfo = LFTri.kr(lfo_rate,(rand_val*2.0)!2); + + ramp_env = ramp_ratio * EnvGen.kr( + Env.adsr(ramp_length,0,1.0,0), + doneAction: 2 + ) + (1-ramp_ratio); + + pulse = Mix(Pulse.ar(note*ramp_env*[1,1.001]*(1.0+(lfo_width*lfo)),[0.2,0.19]))*0.5; + + snd = RLPF.ar(pulse,cutoff,res); + + snd = BLowShelf.ar(snd,351,1.0,-9); + + env = Env.new( + [0, attack_level, decay_level, sustain_level, 0], + [attack, decay, 0, release], + \lin, + 3 + ); + + snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, gate, doneAction: 2), pan); + + Out.ar(out_bus, snd * amp); +}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/"); +) \ No newline at end of file