Skip to content

Commit d4eefa5

Browse files
committed
Synths - fix up sc808 cymbal
1 parent ffc8061 commit d4eefa5

File tree

3 files changed

+36
-28
lines changed

3 files changed

+36
-28
lines changed

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

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4693,38 +4693,27 @@ def synth_name
46934693
"sc808_cymbal"
46944694
end
46954695

4696-
def on_start(studio, args_h)
4697-
args_h[:rand_buf] = studio.rand_buf_id
4698-
end
4699-
47004696
def doc
47014697
"Cymbal 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."
47024698
end
47034699

47044700
def arg_defaults
47054701
{
47064702
:amp => 1,
4703+
:amp_slide => 0,
4704+
:amp_slide_shape => 1,
4705+
:amp_slide_curve => 0,
47074706
:pan => 0,
4708-
:decay => 0.5,
4707+
:pan_slide => 0,
4708+
:pan_slide_shape => 1,
4709+
:pan_slide_curve => 0,
4710+
:decay => 2,
4711+
:decay_curve => -3,
4712+
:tone => 0.002
47094713
}
47104714
end
47114715

4712-
def default_arg_info
4713-
super.merge({
4714-
:amp =>
4715-
{
4716-
: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.)",
4717-
:validations => [v_positive(:amp)],
4718-
:modulatable => false
4719-
},
4720-
:pan =>
4721-
{
4722-
: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.",
4723-
:validations => [v_between_inclusive(:pan, -1, 1)],
4724-
:modulatable => false
4725-
},
4726-
})
4727-
end
4716+
47284717

47294718
def specific_arg_info
47304719
{
@@ -4734,6 +4723,18 @@ def specific_arg_info
47344723
:validations => [v_positive(:decay)],
47354724
:modulatable => false
47364725
},
4726+
:decay_curve =>
4727+
{
4728+
:doc => "Curve value for the decay of the hi-hat",
4729+
:validations => [],
4730+
:modulatable => false
4731+
},
4732+
:tone =>
4733+
{
4734+
:doc => "Change the timbre by adding in additional frequencies to the sound",
4735+
:validations => [v_positive(:tone), v_less_than_oet(:tone, 1)],
4736+
:modulatable => true
4737+
},
47374738
}
47384739
end
47394740
end
Binary file not shown.

etc/synthdefs/designs/supercollider/sc808.scd

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -557,17 +557,24 @@ SynthDef('sonic-pi-sc808_open_hihat', {|
557557
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
558558
)
559559

560+
(
560561
SynthDef('sonic-pi-sc808_cymbal', {|
561562

562-
amp = 1,
563-
pan = 0,
563+
amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
564+
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
565+
564566
decay=2,
565-
tone=0.002,
567+
decay_curve = -3
568+
tone=0.25,
566569

567570
out_bus = 0|
568571

569572
var sig, sig1, sig2, sig2a, sig2b, sig3, env1, env2, env2b, env3, osc1, osc2, osc3, osc4, osc5, osc6, sum;
570-
env1 = EnvGen.kr(Env.perc(0.3, decay, curve:-3), doneAction:2);
573+
574+
amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape);
575+
pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape);
576+
tone = tone * 0.008;
577+
env1 = EnvGen.kr(Env.perc(0.3, decay, curve:decay_curve), doneAction:2);
571578
env2 = EnvGen.kr(Env.new([0, 0.6, 0], [0.1, decay*0.7], -5), doneAction:0);
572579
env2b = EnvGen.kr(Env.new([0, 0.3, 0], [0.1, decay*20], -120), doneAction:0);
573580
env3 = EnvGen.kr(Env.new([0, 1, 0], [0, decay*5], curve:-150), doneAction:0);
@@ -599,9 +606,9 @@ SynthDef('sonic-pi-sc808_cymbal', {|
599606
sig3 = sig3 * env3;
600607
sum = sig1 + sig2a + sig2b + sig3;
601608
sum = LPF.ar(sum, 4000);
602-
sum = Pan2.ar(sum, 0);
603609
sum = sum * amp * 12;
604-
Out.ar(0, sum);
610+
DetectSilence.ar(sum, doneAction: Done.freeSelf);
611+
Out.ar(0, Pan2.ar(sum, pan));
605612

606-
}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
613+
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
607614
)

0 commit comments

Comments
 (0)