Skip to content

Commit 9f29a7f

Browse files
committed
Synths - fix up sc808-cowbell
1 parent 7a1606e commit 9f29a7f

File tree

3 files changed

+52
-59
lines changed

3 files changed

+52
-59
lines changed

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

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4456,7 +4456,7 @@ def arg_defaults
44564456
:hpf => 113,
44574457
:hpf_slide => 0,
44584458
:hpf_slide_shape => 1,
4459-
:hpf_slide_curve => 0
4459+
:hpf_slide_curve => 0,
44604460
:click => 1,
44614461
:decay => 0.1,
44624462
:decay_curve => -20
@@ -4510,70 +4510,58 @@ def synth_name
45104510
"sc808_cowbell"
45114511
end
45124512

4513-
def on_start(studio, args_h)
4514-
args_h[:rand_buf] = studio.rand_buf_id
4515-
end
4516-
45174513
def doc
45184514
"Cowbell 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."
45194515
end
45204516

45214517
def arg_defaults
45224518
{
4523-
:note => 79.58979585613574,
4519+
:note => 79.59,
4520+
:detune => -7.084,
45244521
:amp => 1,
4522+
:amp_slide => 0,
4523+
:amp_slide_shape => 1,
4524+
:amp_slide_curve => 0,
45254525
:pan => 0,
4526-
:note2 => 72.50534928521387,
4527-
:cutoff_lo => 59,
4528-
:cutoff_hi => 109,
4526+
:pan_slide => 0,
4527+
:pan_slide_shape => 1,
4528+
:pan_slide_curve => 0,
4529+
:hpf => 113,
4530+
:hpf_slide => 0,
4531+
:hpf_slide_shape => 1,
4532+
:hpf_slide_curve => 0,
4533+
:decay => 9.5,
4534+
:decay_curve => -90
45294535
}
45304536
end
45314537

4532-
def default_arg_info
4533-
super.merge({
4534-
:note =>
4535-
{
4536-
:doc => "Note to play. Either a MIDI number or a symbol representing a note. For example: `30`, `52`, `:C`, `:C2`, `:Eb4`, or `:Ds3`",
4537-
:validations => [v_positive(:note)],
4538-
:modulatable => false,
4539-
:midi => true
4540-
},
4541-
:amp =>
4542-
{
4543-
: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.)",
4544-
:validations => [v_positive(:amp)],
4545-
:modulatable => false
4546-
},
4547-
:pan =>
4548-
{
4549-
: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.",
4550-
:validations => [v_between_inclusive(:pan, -1, 1)],
4551-
:modulatable => false
4552-
},
4553-
})
4554-
end
4555-
45564538
def specific_arg_info
45574539
{
4558-
:note2 =>
4540+
:detune =>
45594541
{
4560-
:doc => "Second base frequency of the sound. Play with both both `:note` and `:note2` for slight changes of timbre and, of course, pitch.",
4561-
:validations => [v_positive(:note2)],
4562-
:modulatable => false,
4563-
:midi => true
4542+
:doc => "Distance (in MIDI notes) between components of sound. Affects thickness, sense of tuning and harmony. Tiny values such as 0.1 create a thick sound. Larger values such as 0.5 make the tuning sound strange. Even bigger values such as 5 create chord-like sounds.",
4543+
:validations => [],
4544+
:modulatable => true
45644545
},
4565-
:cutoff_lo =>
4546+
:decay =>
45664547
{
4567-
:doc => "MIDI note representing the lowest frequencies allowed to be present in the sound.",
4568-
:validations => [v_positive(:cutoff_lo)],
4548+
:doc => "Amount of decay for the cowbell. Higher numbers increase the decay duration.",
4549+
:validations => [v_positive_not_zero(:decay)],
45694550
:modulatable => false
45704551
},
4571-
:cutoff_hi =>
4552+
:decay_curve =>
45724553
{
4573-
:doc => "MIDI note representing the highest frequencies allowed to be present in the sound.",
4574-
:validations => [v_positive(:cutoff_hi)],
4554+
:doc => "Curve value for the decay of the cowbell",
4555+
:validations => [],
45754556
:modulatable => false
45764557
},
4558+
:hpf =>
4559+
{
4560+
:doc => "High pass filter cutoff value for the cowbell. A MIDI note representing the lowest frequencies allowed to be present in the sound. A high value like 100 makes the sound thin and whispy, a low value like 40 removes just the lower bass components of the sound.",
4561+
:validations => [v_positive(:hpf), v_less_than(:hpf, 119)],
4562+
:modulatable => true,
4563+
:midi => true
4564+
}
45774565
}
45784566
end
45794567
end
Binary file not shown.

etc/synthdefs/designs/supercollider/sc808.scd

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -425,37 +425,42 @@ SynthDef('sonic-pi-sc808_maracas', {|
425425

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

428+
(
428429
SynthDef('sonic-pi-sc808_cowbell', {|
429430

430431
note = 79.58979585613574,
431-
note2 = 72.50534928521387,
432-
amp = 1,
433-
pan = 0,
434-
cutoff_lo = 59,
435-
cutoff_hi = 109,
436-
432+
detune = -7.08444657092187
433+
amp = 1, amp_slide = 0, amp_slide_shape = 1, amp_slide_curve = 0,
434+
pan = 0, pan_slide = 0, pan_slide_shape = 1, pan_slide_curve = 0,
435+
hpf = 59, hpf_slide = 0, hpf_slide_shape = 1, hpf_slide_curve = 1,
436+
lpf = 109, lpf_slide = 0, lpf_slide_shape = 1, lpf_slide_curve = 1,
437+
decay = 9.5,
438+
decay_curve = -90,
437439
out_bus = 0|
438440

439-
var sig, pul1, pul2, env, atk, atkenv, datk;
440-
441+
var sig, pul1, pul2, env, atk, atkenv, datk, note2;
442+
note2 = note + detune;
441443
note = note.midicps;
442444
note2 = note2.midicps;
443-
cutoff_lo = cutoff_lo.midicps;
444-
cutoff_hi = cutoff_hi.midicps;
445+
hpf = hpf.midicps;
446+
lpf = lpf.midicps;
447+
hpf = hpf.varlag(hpf_slide, hpf_slide_curve, hpf_slide_shape);
448+
lpf = lpf.varlag(lpf_slide, lpf_slide_curve, lpf_slide_shape);
445449

446450
atkenv = EnvGen.kr(Env.perc(0, 1, 1, -215),doneAction:0);
447-
env = EnvGen.kr(Env.perc(0.01, 9.5, 1, -90),doneAction:2);
451+
env = EnvGen.kr(Env.perc(0.01, decay, 1, decay_curve),doneAction:2);
448452
pul1 = LFPulse.ar(note);
449453
pul2 = LFPulse.ar(note2);
450454
atk = (pul1 + pul2) * atkenv * 6;
451455
datk = (pul1 + pul2) * env;
452456
sig = (atk + datk) * amp / 6;
453-
sig = HPF.ar(sig, cutoff_lo);
454-
sig = LPF.ar(sig, cutoff_hi);
455-
457+
sig = HPF.ar(sig, hpf);
458+
sig = LPF.ar(sig, lpf);
459+
DetectSilence.ar(sig, doneAction: Done.freeSelf);
456460
Out.ar(out_bus, Pan2.ar(sig, pan));
457461

458-
}).writeDefFile("/Users/sam/Development/RPi/sonic-pi/etc/synthdefs/compiled/");
462+
}).writeDefFile("/Users/sam/Development/sonic-pi/etc/synthdefs/compiled/");
463+
)
459464

460465
SynthDef('sonic-pi-sc808_closed_hihat', {|
461466

0 commit comments

Comments
 (0)