Skip to content

Commit 78ca99d

Browse files
committed
Synths - fix up sc808-claves
1 parent 43bcb8d commit 78ca99d

File tree

3 files changed

+36
-23
lines changed

3 files changed

+36
-23
lines changed

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

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4379,9 +4379,6 @@ def synth_name
43794379
"sc808_claves"
43804380
end
43814381

4382-
def on_start(studio, args_h)
4383-
args_h[:rand_buf] = studio.rand_buf_id
4384-
end
43854382

43864383
def doc
43874384
"Claves 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."
@@ -4391,32 +4388,41 @@ def arg_defaults
43914388
{
43924389
:note => 99,
43934390
:amp => 1,
4391+
:amp_slide => 0,
4392+
:amp_slide_shape => 1,
4393+
:amp_slide_curve => 0,
43944394
:pan => 0,
4395+
:pan_slide => 0,
4396+
:pan_slide_shape => 1,
4397+
:pan_slide_curve => 0,
4398+
:click => 1,
4399+
:decay => 0.1,
4400+
:decay_curve => -20
43954401
}
43964402
end
43974403

4398-
def default_arg_info
4399-
super.merge({
4400-
:note =>
4404+
def specific_arg_info
4405+
{
4406+
:click =>
44014407
{
4402-
:doc => "Note to play. Either a MIDI number or a symbol representing a note. For example: `30`, `52`, `:C`, `:C2`, `:Eb4`, or `:Ds3`",
4403-
:validations => [v_positive(:note)],
4404-
:modulatable => false,
4405-
:midi => true
4408+
:doc => "Amount of initial click to the claves sound. 0 is no click and 1 is a hard click.",
4409+
:validations => [v_between_inclusive(:click, 0, 1)],
4410+
:modulatable => false
44064411
},
4407-
:amp =>
4412+
:decay =>
44084413
{
4409-
: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.)",
4410-
:validations => [v_positive(:amp)],
4414+
:doc => "Amount of decay for the claves. Higher numbers increase the decay duration.",
4415+
:validations => [v_positive_not_zero(:decay)],
44114416
:modulatable => false
44124417
},
4413-
:pan =>
4418+
4419+
:decay_curve =>
44144420
{
4415-
: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.",
4416-
:validations => [v_between_inclusive(:pan, -1, 1)],
4421+
:doc => "Curve value for the decay of the claves",
4422+
:validations => [],
44174423
:modulatable => false
44184424
},
4419-
})
4425+
}
44204426
end
44214427
end
44224428

Binary file not shown.

etc/synthdefs/designs/supercollider/sc808.scd

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,25 +369,32 @@ SynthDef('sonic-pi-sc808_rimshot', {|
369369
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
370370
)
371371

372-
373372
SynthDef('sonic-pi-sc808_claves', {|
374373

375-
amp = 1,
374+
376375
note = 99,
377-
pan = 0,
376+
amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
377+
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
378+
decay = 0.1,
379+
decay_curve = -20,
380+
click = 1,
381+
378382

379383
out_bus = 0|
380384

381385
var sig, env;
382386

383387
note = note.midicps;
384388

385-
env = EnvGen.kr(Env.new([1, 1, 0], [0, 0.1], -20), doneAction:2);
386-
sig = SinOsc.ar(note, pi/2) * env * amp;
389+
amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape);
390+
pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape);
387391

392+
env = EnvGen.kr(Env.new([click, 1, 0], [0, decay], decay_curve), doneAction:2);
393+
sig = SinOsc.ar(note, pi/2) * env * amp;
394+
DetectSilence.ar(sig, doneAction: Done.freeSelf);
388395
Out.ar(out_bus, Pan2.ar(sig, pan));
389396

390-
}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
397+
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
391398

392399
SynthDef('sonic-pi-sc808_maracas', {|
393400

0 commit comments

Comments
 (0)