Skip to content

Commit

Permalink
Merge pull request #2628 from level-xx/main
Browse files Browse the repository at this point in the history
Synths winwood_lead, bass_foundation, and bass_highend
  • Loading branch information
samaaron committed Apr 27, 2021
2 parents 5b77b1b + 985f289 commit 0c1ea59
Show file tree
Hide file tree
Showing 7 changed files with 373 additions and 0 deletions.
211 changes: 211 additions & 0 deletions app/server/ruby/lib/sonicpi/synths/synthinfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3290,6 +3290,214 @@ def arg_defaults
end
end

class WinwoodLead < SonicPiSynth
def name
"Winwood Lead"
end

def introduced
Version.new(3,3,0)
end

def synth_name
"winwood_lead"
end

def on_start(studio, args_h)
args_h[:rand_buf] = studio.rand_buf_id
end

def doc
"A lead synth inspired by the Winwood songs from the early 80s. Adapted for Sonic Pi from [Steal This Sound](https://raw.githubusercontent.com/supercollider/supercollider/develop/examples/demonstrations/stealthissound.scd). Published there under [GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html), so re-published under the same terms. The source code is available [on the Sonic Pi GitHub repository](https://github.com/sonic-pi-net/sonic-pi). Date of modification: 10.01.2021"
end

def arg_defaults
{
: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.01,
:decay => 0,
:sustain => 0.9,
:release => 0.05,
:attack_level => 1,
:decay_level => 0.5,
:sustain_level => 0.5,

:cutoff => 119,
:cutoff_slide => 0,
:cutoff_slide_shape => 1,
:cutoff_slide_curve => 0,

:res => 0.8,
:res_slide => 0,
:res_slide_shape => 1,
:res_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,
:seed => 0,
}
end

def specific_arg_info
{
:seed =>
{
:doc => "Seed value for rand num generator used for the phase offset of the triangle low-frequency oscillator (LFO)",
:modulatable => false
},
:lfo_width =>
{
:doc => "Width of the low-frequency oscillator (LFO) which determines how wide base tones oscillate around their base frequencies",
:modulatable => true
},
:lfo_rate =>
{
:doc => "Width of the low-frequency oscillator (LFO) which determines how fast base tones oscillate around their base frequencies",
:modulatable => true
},
}
end
end

class BassFoundation < SonicPiSynth
def name
"Bass Foundation"
end

def introduced
Version.new(3,3,0)
end

def synth_name
"bass_foundation"
end

def doc
"A soft bass synth inspired by the sounds of the 80s. Use together with :bass_highend if you want to give it a gargling component. Adapted for Sonic Pi from [Steal This Sound](https://raw.githubusercontent.com/supercollider/supercollider/develop/examples/demonstrations/stealthissound.scd). Published there under [GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html), so re-published under the same terms. The source code is available [on the Sonic Pi GitHub repository](https://github.com/sonic-pi-net/sonic-pi). Date of modification: 10.01.2021"
end

def arg_defaults
{
: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.01,
:decay => 0,
:sustain => 0.9,
:release => 0.05,
:attack_level => 1,
:decay_level => 0.5,
:sustain_level => 0,

: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,
}
end
end

class BassHighend < SonicPiSynth
def name
"Bass Highend"
end

def introduced
Version.new(3,3,0)
end

def synth_name
"bass_highend"
end

def doc
"An addition to the :bass_foundation synth inspired by the sounds of the 80s. Use them together if you want to give it a rough, slurping, or gargling component. Adapted for Sonic Pi from [Steal This Sound](https://raw.githubusercontent.com/supercollider/supercollider/develop/examples/demonstrations/stealthissound.scd). Published there under [GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html), so re-published under the same terms. The source code is available [on the Sonic Pi GitHub repository](https://github.com/sonic-pi-net/sonic-pi). Date of modification: 11.01.2021"
end

def arg_defaults
{
: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.01,
:decay => 0,
:sustain => 0.9,
:release => 0.05,
:attack_level => 1,
:decay_level => 0.5,
:sustain_level => 0,

:cutoff => 102,
:cutoff_slide => 0,
:cutoff_slide_shape => 1,
:cutoff_slide_curve => 0,

:res => 0.1,
: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,
}
end

def specific_arg_info
{
:drive =>
{
:doc => "Higher drive values make the sound louder and rougher.",
:validations => [v_positive(:drive)],
:modulatable => true
},
}
end
end

class StudioInfo < SonicPiSynth
def user_facing?
false
Expand Down Expand Up @@ -7949,6 +8157,9 @@ class BaseInfo
:kalimba => SynthKalimba.new,
:pluck => SynthPluck.new,
:tech_saws => TechSaws.new,
:winwood_lead => WinwoodLead.new,
:bass_foundation => BassFoundation.new,
:bass_highend => BassHighend.new,

:sound_in => SoundIn.new,
:sound_in_stereo => SoundInStereo.new,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
46 changes: 46 additions & 0 deletions etc/synthdefs/designs/supercollider/bass_foundation.scd
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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', {|
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.01, decay = 0, sustain = 0.9, release = 0.05,
attack_level = 1, decay_level = 0.5, sustain_level = 0,
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,
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.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
);

snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, doneAction: 2), pan);

Out.ar(out_bus, snd * amp);
}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
)
58 changes: 58 additions & 0 deletions etc/synthdefs/designs/supercollider/bass_highend.scd
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// 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',{|
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.01, decay = 0, sustain = 0.9, release = 0.05,
attack_level = 1, decay_level = 0.5, sustain_level = 0,
cutoff = 102, cutoff_slide = 0, cutoff_slide_shape = 1, cutoff_slide_curve = 0,
res = 0.1, 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,
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.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
);

snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, doneAction: 2) * 2, pan);

Out.ar(out_bus, snd * amp);

}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
)
58 changes: 58 additions & 0 deletions etc/synthdefs/designs/supercollider/winwood_lead.scd
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// 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-winwood_lead', {|
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.01, decay = 0, sustain = 0.9, release = 0.05,
attack_level = 1, decay_level = 0.5, sustain_level = 0.5,
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.8, res_slide = 0, res_slide_shape = 1, res_slide_curve = 0,
seed = 0, rand_buf = 0,
out_bus = 0|

var snd, pulse, env, lfo;
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.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);

pulse = Mix(Pulse.ar(note*[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,sustain,release],
\lin
);

snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, doneAction: 2), pan);

Out.ar(out_bus, snd * amp);
}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
)

0 comments on commit 0c1ea59

Please sign in to comment.