Skip to content

Commit 4cbba93

Browse files
committed
Synths - fix up sc808 open hihat
1 parent a28371e commit 4cbba93

File tree

3 files changed

+37
-42
lines changed

3 files changed

+37
-42
lines changed

app/server/ruby/lib/sonicpi/synths/synthinfo.rb

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4619,7 +4619,7 @@ def specific_arg_info
46194619
:doc => "Curve value for the decay of the hi-hat",
46204620
:validations => [],
46214621
:modulatable => false
4622-
}
4622+
},
46234623
:lpf =>
46244624
{
46254625
:doc => "Low pass filter cutoff value for the hi-hat. A MIDI note representing the highest frequencies allowed to be present in the sound. A low value like 30 makes the sound round and dull, a high value like 100 makes the sound buzzy and crispy.",
@@ -4639,7 +4639,7 @@ def specific_arg_info
46394639
end
46404640
end
46414641

4642-
class SC808OpenHihat < SonicPiSynth
4642+
class SC808OpenHihat < SC808ClosedHihat
46434643
def name
46444644
"SC-808 Open Hi-Hat"
46454645
end
@@ -4652,48 +4652,30 @@ def synth_name
46524652
"sc808_open_hihat"
46534653
end
46544654

4655-
4656-
def on_start(studio, args_h)
4657-
args_h[:rand_buf] = studio.rand_buf_id
4658-
end
4659-
46604655
def doc
46614656
"Open hi-hat of the SC808 drum machine based on [Yoshinosuke Horiuchi's](https://www.patreon.com/4H/posts) implementation of the legendary rhythm composer from the early 80s. This is a percussive synth, so it does not use the standard envelope parameters, neither does it feature slideable parameters. Note that this synth is rather faint and may require an amp of 2 or more to be heard."
46624657
end
46634658

46644659
def arg_defaults
46654660
{
46664661
:amp => 1,
4662+
:amp_slide => 0,
4663+
:amp_slide_shape => 1,
4664+
:amp_slide_curve => 0,
46674665
:pan => 0,
4666+
:pan_slide => 0,
4667+
:pan_slide_shape => 1,
4668+
:pan_slide_curve => 0,
4669+
:hpf => 118.551,
4670+
:hpf_slide => 0,
4671+
:hpf_slide_shape => 1,
4672+
:hpf_slide_curve => 0,
4673+
:lpf => 107.213,
4674+
:lpf_slide => 0,
4675+
:lpf_slide_shape => 1,
4676+
:lpf_slide_curve => 0,
46684677
:decay => 0.5,
4669-
}
4670-
end
4671-
4672-
def default_arg_info
4673-
super.merge({
4674-
:amp =>
4675-
{
4676-
:doc => "The amplitude of the sound. Typically a value between 0 and 1. Higher amplitudes may be used, but won't make the sound louder, they will just reduce the quality of all the sounds currently being played (due to compression.)",
4677-
:validations => [v_positive(:amp)],
4678-
:modulatable => false
4679-
},
4680-
:pan =>
4681-
{
4682-
:doc => "Position of sound in stereo. With headphones on, this means how much of the sound is in the left ear, and how much is in the right ear. With a value of -1, the sound is completely in the left ear, a value of 0 puts the sound equally in both ears and a value of 1 puts the sound in the right ear. Values in between -1 and 1 move the sound accordingly.",
4683-
:validations => [v_between_inclusive(:pan, -1, 1)],
4684-
:modulatable => false
4685-
},
4686-
})
4687-
end
4688-
4689-
def specific_arg_info
4690-
{
4691-
:decay =>
4692-
{
4693-
:doc => "Decay of the hi-hat in seconds, for shorter and longer sounds. Values beyond 1 may not really sound like a hi-hat, but interesting anyway.",
4694-
:validations => [v_positive(:decay)],
4695-
:modulatable => false
4696-
},
4678+
:decay_curve => -3
46974679
}
46984680
end
46994681
end
Binary file not shown.

etc/synthdefs/designs/supercollider/sc808.scd

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -505,17 +505,28 @@ SynthDef('sonic-pi-sc808_closed_hihat', {|
505505
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
506506
)
507507

508+
(
508509
SynthDef('sonic-pi-sc808_open_hihat', {|
509510

510-
amp = 1,
511-
pan = 0,
512-
decay=0.5,
511+
amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
512+
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
513+
hpf = 118.551, hpf_slide = 0, hpf_slide_shape = 1, hpf_slide_curve = 1,
514+
lpf = 107.213, lpf_slide = 0, lpf_slide_shape = 1, lpf_slide_curve = 1,
513515

516+
decay=0.5,
517+
decay_curve = -3,
514518
out_bus = 0|
515519

516520
var sig, siga, sigb, env1, env2, osc1, osc2, osc3, osc4, osc5, osc6, sum;
517521

518-
env1 = EnvGen.kr(Env.perc(0.1, decay, curve:-3), doneAction:2);
522+
hpf = hpf.midicps;
523+
lpf = lpf.midicps;
524+
hpf = hpf.varlag(hpf_slide, hpf_slide_curve, hpf_slide_shape);
525+
lpf = lpf.varlag(lpf_slide, lpf_slide_curve, lpf_slide_shape);
526+
527+
528+
529+
env1 = EnvGen.kr(Env.perc(0.1, decay, curve: decay_curve), doneAction:2);
519530
env2 = EnvGen.kr(Env.new([0, 1, 0], [0, decay*5], curve:-150), doneAction:0);
520531
osc1 = LFPulse.ar(203.52) * 0.6;
521532
osc2 = LFPulse.ar(366.31) * 0.6;
@@ -525,19 +536,21 @@ SynthDef('sonic-pi-sc808_open_hihat', {|
525536
osc6 = LFPulse.ar(538.75) * 0.6;
526537
sig = osc1 + osc2 + osc3 + osc4 + osc5 +osc6;
527538
sig = BLowShelf.ar(sig, 990, 2, -3);
528-
sig = BPF.ar(sig, 7700);
539+
sig = BPF.ar(sig, hpf);
529540
sig = BPeakEQ.ar(sig, 7200, 0.5, 5);
530541
sig = BHiPass4.ar(sig, 8100, 0.7);
531542
sig = BHiShelf.ar(sig, 9400, 1, 5);
532543
siga = sig * env1 * 0.6;
533544
sigb = sig * env2;
534545
sum = siga + sigb;
535-
sum = LPF.ar(sum, 4000);
546+
sum = LPF.ar(sum, lpf);
536547
sum = sum * amp * 7;
537548

549+
DetectSilence.ar(sum, doneAction: Done.freeSelf);
538550
Out.ar(out_bus, Pan2.ar(sum, pan));
539551

540-
}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
552+
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
553+
)
541554

542555
SynthDef('sonic-pi-sc808_cymbal', {|
543556

0 commit comments

Comments
 (0)