Skip to content

Commit 8657329

Browse files
committed
Synths - fix up sc808 maracas
1 parent 78ca99d commit 8657329

File tree

3 files changed

+42
-27
lines changed

3 files changed

+42
-27
lines changed

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

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4439,44 +4439,50 @@ def synth_name
44394439
"sc808_maracas"
44404440
end
44414441

4442-
def on_start(studio, args_h)
4443-
args_h[:rand_buf] = studio.rand_buf_id
4444-
end
4445-
44464442
def doc
44474443
"Maracas 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."
44484444
end
44494445

44504446
def arg_defaults
44514447
{
4452-
:cutoff => 113,
44534448
:amp => 1,
4449+
:amp_slide => 0,
4450+
:amp_slide_shape => 1,
4451+
:amp_slide_curve => 0,
44544452
:pan => 0,
4453+
:pan_slide => 0,
4454+
:pan_slide_shape => 1,
4455+
:pan_slide_curve => 0,
4456+
:click => 1,
4457+
:decay => 0.1,
4458+
:decay_curve => -20
44554459
}
44564460
end
44574461

4458-
def default_arg_info
4459-
super.merge({
4460-
:amp =>
4462+
def specific_arg_info
4463+
{
4464+
:click =>
44614465
{
4462-
: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.)",
4463-
:validations => [v_positive(:amp)],
4466+
:doc => "Amount of initial click to the maraca sound. 0 is no click and 1 is a hard click.",
4467+
:validations => [v_between_inclusive(:click, 0, 1)],
44644468
:modulatable => false
44654469
},
4466-
:pan =>
4470+
:decay =>
44674471
{
4468-
: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.",
4469-
:validations => [v_between_inclusive(:pan, -1, 1)],
4472+
:doc => "Amount of decay for the maracas. Higher numbers increase the decay duration.",
4473+
:validations => [v_positive_not_zero(:decay)],
44704474
:modulatable => false
44714475
},
4472-
:cutoff =>
4476+
4477+
:decay_curve =>
44734478
{
4474-
:doc => "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.",
4475-
:validations => [v_positive(:cutoff), v_less_than(:cutoff, 131)],
4476-
:modulatable => false,
4477-
:midi => true
4479+
:doc => "Curve value for the decay of the maracas",
4480+
:validations => [],
4481+
:modulatable => false
44784482
},
4479-
})
4483+
}
4484+
4485+
44804486
end
44814487
end
44824488

Binary file not shown.

etc/synthdefs/designs/supercollider/sc808.scd

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,23 +398,32 @@ SynthDef('sonic-pi-sc808_claves', {|
398398

399399
SynthDef('sonic-pi-sc808_maracas', {|
400400

401-
amp = 1,
402-
cutoff = 113,
403-
pan = 0,
401+
402+
403+
amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
404+
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
405+
hpf = 113, hpf_slide = 0, hpf_slide_shape = 1, hpf_slide_curve = 1,
406+
click = 0.027,
407+
decay = 0.07,
408+
decay_curve = -250
404409

405410
out_bus = 0|
406411

407412
var sig, env;
408413

409-
cutoff = cutoff.midicps;
414+
amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape);
415+
pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape);
416+
hpf = hpf.varlag(hpf_slide, hpf_slide_curve, hpf_slide_shape);
410417

411-
env = EnvGen.kr(Env.new([0.3, 1, 0], [0.027, 0.07], -250), doneAction:2);
412-
sig = WhiteNoise.ar * env * amp;
413-
sig = HPF.ar(sig, cutoff);
418+
hpf = hpf.midicps;
414419

420+
env = EnvGen.kr(Env.new([0.3, 1, 0], [click, decay], decay_curve), doneAction:2);
421+
sig = WhiteNoise.ar * env * amp;
422+
sig = HPF.ar(sig, hpf);
423+
DetectSilence.ar(sig, doneAction: Done.freeSelf);
415424
Out.ar(out_bus, Pan2.ar(sig, pan));
416425

417-
}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
426+
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
418427

419428
SynthDef('sonic-pi-sc808_cowbell', {|
420429

0 commit comments

Comments
 (0)