From 8657329c7924084d19225d66d1c4a4e526ddc4b7 Mon Sep 17 00:00:00 2001 From: Sam Aaron Date: Mon, 16 Oct 2023 23:02:54 +0100 Subject: [PATCH] Synths - fix up sc808 maracas --- .../ruby/lib/sonicpi/synths/synthinfo.rb | 44 ++++++++++-------- .../compiled/sonic-pi-sc808_maracas.scsyndef | Bin 570 -> 2067 bytes etc/synthdefs/designs/supercollider/sc808.scd | 25 ++++++---- 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/app/server/ruby/lib/sonicpi/synths/synthinfo.rb b/app/server/ruby/lib/sonicpi/synths/synthinfo.rb index 9e488cc91d..0e091cba8d 100644 --- a/app/server/ruby/lib/sonicpi/synths/synthinfo.rb +++ b/app/server/ruby/lib/sonicpi/synths/synthinfo.rb @@ -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 diff --git a/etc/synthdefs/compiled/sonic-pi-sc808_maracas.scsyndef b/etc/synthdefs/compiled/sonic-pi-sc808_maracas.scsyndef index 566b04750ade22472116d14cb1de788a85b6ee17..7bb6350f500f3ac8481d5dbf55bed9bc0c505b77 100644 GIT binary patch literal 2067 zcmbVNOK;Oa5Z<+&IL@O9uNEjzAr2fWUY8swR4tEkp^>5r2_Z$sHN+xutk|wpPW%JT z<;1_>4icww;0JKwkHCEUa1*0AQAgVSc3wN4otdP&_3kZW%wT*u9)*Fo76ogu*S^#4 z4c)QpxiKj#wAiDMjD7pT*an>+9v*()_`+EG*VmQxqobcBYC#XuD7j;P^N*B3kM-d9 z?bY>9uWx<-peHcR#>O?q!q zyl9iwO?zt;Cgah769Z~dt~s){JFo6Sua__+wzeC(n6zZ5GMzwYB?t}U6M3Qr()1imR9v0!f4sUTFW32r z!O=E^@@6$q#G5D0qpmJpQHUv>k;i$c7R*D}OXr)`e)r}1$_7bS>a zxfyw^!eqfbDmlA+9^%JSL}#!S8D50}(K0r}-0nO*z6hdg*oZD;Ga8Tm#P^bJFz`c9d<%*r8|*qP)Dx5y p+6qm>>bT)OT#c~+GA0}dFM!c+XBg&AnrK64B;lXvhB^Z&=0C}on4rZ?I)414p_(IX=hNxxO6TE&zZ7+pet9S+CH&D(mm}=Sx+pOjT%hPo8l_46u$@ ztJn8WfWxo7oxvNx#}mNO%k?f=l5)du{ECo5Een!KRy(_(yO=1HLFTEg-TbDeD+E?I z9a-Z_d(Ti1BxVsCGo#AKNiiGehOEEZY9f?KPR)b2XcO%p1lcWSEzP|ao`aTN2M&EY zen0V?dJcWp+CE#qy3;Pdu)4~5_+K1+bExA;WKgkYrH3Fi@&AJOI1yZ&PtRf_GCJOE j9+S(dG6xi({!MR4e1IrS4xEcg?Lsgn=ve9{F?Rh0UNnE9 diff --git a/etc/synthdefs/designs/supercollider/sc808.scd b/etc/synthdefs/designs/supercollider/sc808.scd index 22d80d8295..fc293925f3 100644 --- a/etc/synthdefs/designs/supercollider/sc808.scd +++ b/etc/synthdefs/designs/supercollider/sc808.scd @@ -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', {|