And I added the an analogdrum Ugen, you’ll need that
Still not right, but its close I think
SynthDef(\realisticSnare, {
arg out=0, amp=0.5, mul=1, pan=0, hpf =443, bss =5,
freq1=111, freq2=333, freq3=55, atck= 0.001, hrm = 7, anaMul =3,
transientAmp=1, transientDecay=0.01,
drumHeadDelay=0.005, drumHeadFeedback=0.5, drumHeadGain=1,
feedbackLoopTime=0.005, // Parameter for feedback loop time
eqFreq1=500, eqQ1=1, eqGain1=0,
eqFreq2=1000, eqQ2=1, eqGain2=0,
eqFreq3=2000, eqQ3=1, eqGain3=0,
reverbMix=0.2, reverbRoom=0.5, reverbDamp=0.5,
duration=1;
var transient,bsdrm,overallEnv, springs, ana, drumHead, snare, reverb, harmonics;
// Transient (Channel 1)
transient = BrownNoise.ar(0.9) + WhiteNoise.ar(mul) * Env.perc(0.001, transientDecay).ar;
transient = transient + Pulse.ar(233, 0.5, 1) * Env.perc(0.001, transientDecay * 0.5).ar;
transient = HPF.ar(transient, FSinOsc.kr(1, 0, hpf, 4000), 5);
springs = Mix.new([
StringVoice.ar( transient, infsustain: 0.3, freq: Rand(200.0, 400.0), accent: 0.3, structure: 0.5, brightness: 1, damping: 0.4),
StringVoice.ar( transient, infsustain: 0.3, freq: Rand(200.0, 400.0), accent: 0.3, structure: 0.5, brightness: 1, damping: 0.4),
StringVoice.ar( transient, infsustain: 0.3, freq: Rand(200.0, 400.0), accent: 0.3, structure: 0.5, brightness: 1, damping: 0.4)]);
springs * Env.perc(0.001, transientDecay).ar;
// Harmonics generation
harmonics = Mix.new([
Pulse.ar(freq1, 0.5, 0.33),
Pulse.ar(freq2, 0.2, 0.33),
Pulse.ar(freq3, 0.3, 0.33)
]);
harmonics * hrm;
bsdrm= AnalogBassDrum.ar(
transient, infsustain: 0.3, accent: 0.9, freq: 22, tone: 0.3, decay: 0.2,
attackfm: 0.1,selffm:0.2);
bsdrm * bss;
ana= AnalogSnareDrum.ar(transient, infsustain: 0.2, accent: 0.3, freq: 136, tone: 0.164885, decay: 0.3, snappy: 0.1311094)* anaMul * Env.perc(0.001, transientDecay).ar;
transient = transient + (harmonics * Env.perc(atck, transientDecay * 2).ar).tanh;
transient = transient * transientAmp;
transient = transient * transientDecay;
// Drum Head (Channel 2) with controllable feedback loop time
drumHead = LocalIn.ar(1) + (transient * drumHeadGain * springs);
drumHead = DelayC.ar(drumHead, 1, feedbackLoopTime); // Control the feedback loop time
drumHead = drumHead.tanh; // Soft limiting to prevent runaway
LocalOut.ar(drumHead * drumHeadFeedback);
// Apply EQ to the entire signal (transient + drum head)
snare = Mix([transient, drumHead, ana,bsdrm]);
// Multiple EQ stages
snare = BPeakEQ.ar(snare, eqFreq1, eqQ1, eqGain1);
snare = BPeakEQ.ar(snare, eqFreq2, eqQ2, eqGain2);
snare = BPeakEQ.ar(snare, eqFreq3, eqQ3, eqGain3);
snare = Mix([snare, ana, bsdrm]) * 2;
snare = LeakDC.ar(snare);
// Reverb
reverb = FreeVerb.ar(snare, reverbMix, reverbRoom, reverbDamp);
// Create an overall envelope
overallEnv = EnvGen.kr(Env.linen(0.01, duration - 0.02, 2), doneAction: 2);
// Apply the overall envelope to the final output
reverb = reverb * overallEnv;
Out.ar(out, Pan2.ar(reverb * amp, pan));
}).add;
// Example usage
(
Synth(\realisticSnare, [
\amp, 7,
\mul, 7,
\transientAmp, 1,
\hpf, 1300,
\bss, 4,
\freq1, 154,
\freq2, 253,
\freq3, 322,
\anaMul, 2,
\hrm, 3,
\ack, 0.0024,
\transientDecay, 0.28,
\drumHeadFeedback, 0.009,
\drumHeadGain, 0.09,
\feedbackLoopTime, 0.001,
\eqFreq1, 320,
\eqQ1, 4,
\eqGain1, 3,
\eqFreq2, 350,
\eqQ2, 125,
\eqGain2, -4,
\eqFreq3, 200,
\eqQ3, 366,
\eqGain3, 6,
\reverbMix, 0.16,
\reverbRoom, 0.4,
\reverbDamp, 0.9,
\duration, 1 // Set the duration to 1 second
]);
)
---
less bright
(
Synth(\realisticSnare, [
\amp, 3,
\mul, 1.9,
\transientAmp, 1,
\hpf, 1300,
\bss, 6,
\freq1, 154,
\freq2, 253,
\freq3, 322,
\anaMul, 2,
\hrm, 3,
\ack, 0.26,
\transientDecay, 0.3,
\drumHeadFeedback, 0.01,
\drumHeadGain, 1,
\feedbackLoopTime, 0.02,
\eqFreq1, 320,
\eqQ1, 4,
\eqGain1, 3,
\eqFreq2, 1250,
\eqQ2, 25,
\eqGain2, -4,
\eqFreq3, 100,
\eqQ3, 166,
\eqGain3, 6,
\reverbMix, 0.26,
\reverbRoom, 0.6,
\reverbDamp, 1,
\duration, 1 // Set the duration to 1 second
]);
)
----
(
Pbind(
\instrument, \realisticSnare,
\dur, 0.6, // Play every 2 seconds
\amp, 7,
\mul, 7,
\transientAmp, 1,
\hpf, 1300,
\bss, 4,
\freq1, 154,
\freq2, 253,
\freq3, 322,
\anaMul, 2,
\hrm, 3,
\ack, 0.0024,
\transientDecay, 0.28,
\drumHeadFeedback, 0.009,
\drumHeadGain, 0.09,
\feedbackLoopTime, 0.001,
\eqFreq1, 320,
\eqQ1, 4,
\eqGain1, 3,
\eqFreq2, 350,
\eqQ2, 125,
\eqGain2, -4,
\eqFreq3, 200,
\eqQ3, 366,
\eqGain3, 6,
\reverbMix, 0.16,
\reverbRoom, 0.4,
\reverbDamp, 0.9,
\duration, 1 // Set the duration to 1 second
).play;
)