Skip to content

Commit edaeb1e

Browse files
committed
Synths - fix up sc808 bassdrum to match recent sc808 changes
1 parent d4eefa5 commit edaeb1e

File tree

3 files changed

+42
-67
lines changed

3 files changed

+42
-67
lines changed

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

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3770,56 +3770,39 @@ def arg_defaults
37703770
:pan_slide => 0,
37713771
:pan_slide_shape => 1,
37723772
:pan_slide_curve => 0,
3773-
:attack => 0,
3774-
:decay => 0,
3775-
:sustain => 0,
3776-
:release => 1,
3777-
:attack_level => 1,
3778-
:decay_level => :sustain_leval,
3779-
:sustain_level => 1,
3780-
:ndecay => 30,
3773+
:decay => 2,
3774+
:decay_curve => -7,
37813775
:attenuation => 1,
37823776
}
37833777
end
37843778

3785-
def default_arg_info
3786-
super.merge({
3787-
:note =>
3788-
{
3789-
:doc => "Note to play. Either a MIDI number or a symbol representing a note. For example: `30`, `52`, `:C`, `:C2`, `:Eb4`, or `:Ds3`",
3790-
:validations => [v_positive(:note)],
3791-
:modulatable => false,
3792-
:midi => true
3793-
},
3794-
:amp =>
3795-
{
3796-
: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.)",
3797-
:validations => [v_positive(:amp)],
3798-
:modulatable => true
3799-
},
3800-
:pan =>
3801-
{
3802-
: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.",
3803-
:validations => [v_between_inclusive(:pan, -1, 1)],
3804-
:modulatable => false
3805-
},
3806-
})
3807-
end
38083779

38093780
def specific_arg_info
38103781
{
3811-
:ndecay =>
3782+
:decay =>
38123783
{
38133784
:doc => "Internal decay of the bass drum in seconds. Drive it up to 5 or so, in order to get that bass carpet, often featured in hip-hop. Note, you need to increase the duration of the envelope (e.g. the release: opt) to hear this internal decay.",
38143785
:validations => [v_positive(:decay)],
38153786
:modulatable => false
38163787
},
3788+
:decay_curve =>
3789+
{
3790+
:doc => "Curve value for the decay of the bass drum",
3791+
:validations => [],
3792+
:modulatable => false
3793+
}
38173794
:attenuation =>
38183795
{
38193796
:doc => "Base frequency attenuation. Use values around 0.2 or lower for giving the bassdrum a more artificial sound.",
38203797
:validations => [v_positive(:attenuation)],
38213798
:modulatable => false
38223799
},
3800+
:click =>
3801+
{
3802+
:doc => "Amount of initial click to the drum sound. 0 is no click and 1 is a hard click.",
3803+
:validations => [v_between_inclusive(:click, 0, 1)],
3804+
:modulatable => false
3805+
}
38233806
}
38243807
end
38253808
end
Binary file not shown.

etc/synthdefs/designs/supercollider/sc808.scd

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,38 @@ SuperCollider 808 implementation based on Yoshinosuke Horiuchi's free version. S
44

55
(
66
SynthDef('sonic-pi-sc808_bassdrum', {|
7-
note = 34,
8-
amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
9-
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
10-
ndecay = 30,
11-
attenuation=1,
12-
13-
attack = 0, decay = 0, sustain = 0, release = 1,
14-
attack_level = 1, decay_level = -1, sustain_level = 1,
15-
out_bus = 0
16-
|
17-
18-
var snd, fenv, env, trienv, sig, sub, punch, pfenv;
19-
20-
note = note.midicps;
7+
note = 34,
8+
amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
9+
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
10+
click = 0.11
11+
decay = 2,
12+
decay_curve = -7
13+
attenuation=1,
14+
out_bus = 0|
2115

22-
env = EnvGen.kr(Env.new([0.11, 1, 0], [0, ndecay], -7),doneAction:2);
23-
trienv = EnvGen.kr(Env.new([0.11, 0.6, 0], [0, ndecay], -230),doneAction:0);
24-
fenv = Env([note*7, note*1.35, note], [0.05/attenuation, 0.6], -14).kr; // Mod 0.05 -> 0.5
25-
pfenv = Env([note*7, note*1.35, note], [0.03/attenuation, 0.6], -10).kr; // Mod 0.03 -> 0.3
26-
sig = SinOsc.ar(fenv, pi/2) * env;
27-
sub = LFTri.ar(fenv, pi/2) * trienv * 0.05;
28-
punch = SinOsc.ar(pfenv, pi/2) * env * 2;
29-
punch = HPF.ar(punch, 350);
30-
snd = (sig + sub + punch) * 2.5;
16+
var snd, fenv, env, trienv, sig, sub, punch, pfenv;
3117

32-
amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape);
33-
pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape);
34-
decay_level = Select.kr(decay_level < 0, [decay_level, sustain_level]);
35-
env = Env.new(
36-
[0, attack_level, decay_level, sustain_level, 0],
37-
[attack,decay,sustain,release],
38-
\lin
39-
);
18+
note = note.midicps;
19+
amp = 2 * amp;
20+
amp = amp.varlag(amp_slide, amp_slide_curve, amp_slide_shape);
21+
pan = pan.varlag(pan_slide, pan_slide_curve, pan_slide_shape);
4022

41-
snd = Limiter.ar(snd, 1) * amp;
42-
snd = Pan2.ar(Mix(snd) * EnvGen.kr(env, doneAction: 2), pan);
4323

44-
Out.ar(out_bus, snd);
24+
env = EnvGen.kr(Env.new([click, 1, 0], [0, decay], decay_curve),doneAction:2);
25+
trienv = EnvGen.kr(Env.new([click, 0.6, 0], [0, decay], -230),doneAction:0);
26+
fenv = Env([note*7, note*1.35, note], [0.05/attenuation, 0.6], -14).kr; // Mod 0.05 -> 0.5
27+
pfenv = Env([note*7, note*1.35, note], [0.03/attenuation, 0.6], -10).kr; // Mod 0.03 -> 0.3
28+
sig = SinOsc.ar(fenv, pi/2) * env;
29+
sub = LFTri.ar(fenv, pi/2) * trienv * 0.05;
30+
punch = SinOsc.ar(pfenv, pi/2) * env * 2;
31+
punch = HPF.ar(punch, 350);
32+
sig = (sig + sub + punch) * 2.5;
33+
sig = Limiter.ar(sig, 0.5) * amp;
34+
DetectSilence.ar(sig, doneAction: Done.freeSelf);
35+
sig = Pan2.ar(sig, pan);
36+
Out.ar(out_bus, sig);
4537

46-
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled");
38+
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
4739
)
4840

4941
(

0 commit comments

Comments
 (0)