Skip to content

Commit

Permalink
Synths - fix up sc808 maracas
Browse files Browse the repository at this point in the history
  • Loading branch information
samaaron committed Oct 16, 2023
1 parent 78ca99d commit 8657329
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 27 deletions.
44 changes: 25 additions & 19 deletions app/server/ruby/lib/sonicpi/synths/synthinfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4439,44 +4439,50 @@ def synth_name
"sc808_maracas"
end

def on_start(studio, args_h)
args_h[:rand_buf] = studio.rand_buf_id
end

def doc
"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."
end

def arg_defaults
{
:cutoff => 113,
:amp => 1,
:amp_slide => 0,
:amp_slide_shape => 1,
:amp_slide_curve => 0,
:pan => 0,
:pan_slide => 0,
:pan_slide_shape => 1,
:pan_slide_curve => 0,
:click => 1,
:decay => 0.1,
:decay_curve => -20
}
end

def default_arg_info
super.merge({
:amp =>
def specific_arg_info
{
:click =>
{
: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.)",
:validations => [v_positive(:amp)],
:doc => "Amount of initial click to the maraca sound. 0 is no click and 1 is a hard click.",
:validations => [v_between_inclusive(:click, 0, 1)],
:modulatable => false
},
:pan =>
:decay =>
{
: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.",
:validations => [v_between_inclusive(:pan, -1, 1)],
:doc => "Amount of decay for the maracas. Higher numbers increase the decay duration.",
:validations => [v_positive_not_zero(:decay)],
:modulatable => false
},
:cutoff =>

:decay_curve =>
{
: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.",
:validations => [v_positive(:cutoff), v_less_than(:cutoff, 131)],
:modulatable => false,
:midi => true
:doc => "Curve value for the decay of the maracas",
:validations => [],
:modulatable => false
},
})
}


end
end

Expand Down
Binary file modified etc/synthdefs/compiled/sonic-pi-sc808_maracas.scsyndef
Binary file not shown.
25 changes: 17 additions & 8 deletions etc/synthdefs/designs/supercollider/sc808.scd
Original file line number Diff line number Diff line change
Expand Up @@ -398,23 +398,32 @@ SynthDef('sonic-pi-sc808_claves', {|

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

amp = 1,
cutoff = 113,
pan = 0,


amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
hpf = 113, hpf_slide = 0, hpf_slide_shape = 1, hpf_slide_curve = 1,
click = 0.027,
decay = 0.07,
decay_curve = -250

out_bus = 0|

var sig, env;

cutoff = cutoff.midicps;
amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape);
pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape);
hpf = hpf.varlag(hpf_slide, hpf_slide_curve, hpf_slide_shape);

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

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

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

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

Expand Down

0 comments on commit 8657329

Please sign in to comment.