Skip to content

Commit a7f3a78

Browse files
committed
Synths - fix up sc808 closed hihat
1 parent c1e01d7 commit a7f3a78

File tree

3 files changed

+47
-49
lines changed

3 files changed

+47
-49
lines changed

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

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4579,41 +4579,32 @@ def synth_name
45794579
"sc808_closed_hihat"
45804580
end
45814581

4582-
def on_start(studio, args_h)
4583-
args_h[:rand_buf] = studio.rand_buf_id
4584-
end
4585-
45864582
def doc
45874583
"Closed 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."
45884584
end
45894585

45904586
def arg_defaults
45914587
{
45924588
:amp => 1,
4589+
:amp_slide => 0,
4590+
:amp_slide_shape => 1,
4591+
:amp_slide_curve => 0,
45934592
:pan => 0,
4594-
:decay => 0.42,
4595-
:cutoff_lo => 121.05875888638981,
4596-
:cutoff_hi => 121.25219487074914,
4593+
:pan_slide => 0,
4594+
:pan_slide_shape => 1,
4595+
:pan_slide_curve => 0,
4596+
:hpf => 121.252,
4597+
:hpf_slide => 0,
4598+
:hpf_slide_shape => 1,
4599+
:hpf_slide_curve => 0,
4600+
:lpf => 121.0588,
4601+
:lpf_slide => 0,
4602+
:lpf_slide_shape => 1,
4603+
:lpf_slide_curve => 0,
4604+
:decay => 0.42
45974605
}
45984606
end
45994607

4600-
def default_arg_info
4601-
super.merge({
4602-
:amp =>
4603-
{
4604-
: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.)",
4605-
:validations => [v_positive(:amp)],
4606-
:modulatable => false
4607-
},
4608-
:pan =>
4609-
{
4610-
: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.",
4611-
:validations => [v_between_inclusive(:pan, -1, 1)],
4612-
:modulatable => false
4613-
},
4614-
})
4615-
end
4616-
46174608
def specific_arg_info
46184609
{
46194610
:decay =>
@@ -4622,18 +4613,21 @@ def specific_arg_info
46224613
:validations => [v_positive(:decay)],
46234614
:modulatable => false
46244615
},
4625-
:cutoff_lo =>
4616+
:lpf =>
46264617
{
4627-
:doc => "MIDI note representing the lowest frequencies allowed during sound generation. The effect may be unexpected: fiddling with the cutoffs produces a variety of tin sounds.",
4628-
:validations => [v_positive(:cutoff_lo)],
4629-
:modulatable => false
4618+
: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.",
4619+
:validations => [v_positive(:lpf), v_less_than(:lpf, 131)],
4620+
:modulatable => true,
4621+
:midi => true
46304622
},
4631-
:cutoff_hi =>
4623+
:hpf =>
46324624
{
4633-
:doc => "MIDI note representing the highest frequencies allowed during sound generation. The effect may be unexpected: fiddling with the cutoffs produces a variety of tin sounds.",
4634-
:validations => [v_positive(:cutoff_hi)],
4635-
:modulatable => false
4636-
},
4625+
:doc => "High pass filter cutoff value for the rimshot. A MIDI note representing the lowest frequencies allowed to be present in the sound. A high value like 100 makes the sound thin and whispy, a low value like 40 removes just the lower bass components of the sound.",
4626+
:validations => [v_positive(:hpf), v_less_than(:hpf, 131)],
4627+
:modulatable => true,
4628+
:midi => true
4629+
}
4630+
46374631
}
46384632
end
46394633
end
Binary file not shown.

etc/synthdefs/designs/supercollider/sc808.scd

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -465,20 +465,23 @@ SynthDef('sonic-pi-sc808_cowbell', {|
465465
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
466466
)
467467

468+
(
468469
SynthDef('sonic-pi-sc808_closed_hihat', {|
469470

470-
amp = 1,
471-
pan = 0,
472-
decay=0.42,
473-
cutoff_lo = 121.05875888638981,
474-
cutoff_hi = 121.25219487074914,
471+
amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
472+
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
473+
hpf = 121.25219487074914, hpf_slide = 0, hpf_slide_shape = 1, hpf_slide_curve = 1,
474+
lpf = 121.05875888638981, lpf_slide = 0, lpf_slide_shape = 1, lpf_slide_curve = 1,
475475

476+
decay=0.42,
476477
out_bus = 0|
477478

478479
var sig, sighi,siglow, sum, env, osc1, osc2, osc3, osc4, osc5, osc6;
479480

480-
cutoff_lo = cutoff_lo.midicps;
481-
cutoff_hi = cutoff_hi.midicps;
481+
hpf = hpf.midicps;
482+
lpf = lpf.midicps;
483+
hpf = hpf.varlag(hpf_slide, hpf_slide_curve, hpf_slide_shape);
484+
lpf = lpf.varlag(lpf_slide, lpf_slide_curve, lpf_slide_shape);
482485

483486
env = EnvGen.kr(Env.perc(0.005, decay, 1, -30),doneAction:2);
484487
osc1 = LFPulse.ar(203.52);
@@ -488,17 +491,18 @@ SynthDef('sonic-pi-sc808_closed_hihat', {|
488491
osc5 = LFPulse.ar(811.16);
489492
osc6 = LFPulse.ar(538.75);
490493
sighi = (osc1 + osc2 + osc3 + osc4 + osc5 + osc6);
491-
siglow = (osc1 + osc2 + osc3 + osc4 + osc5 + osc6);
492-
sighi = BPF.ar(sighi, cutoff_lo, 1);
493-
sighi = HPF.ar(sighi, cutoff_hi);
494-
siglow = BBandPass.ar(siglow, 8900, 0.8);
495-
siglow = BHiPass.ar(siglow, 9000, 0.3);
496-
sig = BPeakEQ.ar((siglow+sighi), 9700, 0.8, 0.7);
497-
sig = sig * env * amp * 12;
498-
494+
siglow = (osc1 + osc2 + osc3 + osc4 + osc5 + osc6);
495+
sighi = BPF.ar(sighi, lpf, 1);
496+
sighi = HPF.ar(sighi, hpf);
497+
siglow = BBandPass.ar(siglow, 8900, 0.8);
498+
siglow = BHiPass.ar(siglow, 9000, 0.3);
499+
sig = BPeakEQ.ar((siglow+sighi), 9700, 0.8, 0.7);
500+
sig = sig * env * amp * 12;
501+
DetectSilence.ar(sig, doneAction: Done.freeSelf);
499502
Out.ar(out_bus, Pan2.ar(sig, pan));
500503

501-
}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
504+
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
505+
)
502506

503507
SynthDef('sonic-pi-sc808_open_hihat', {|
504508

0 commit comments

Comments
 (0)