Created
May 8, 2023 03:44
-
-
Save schollz/134fbbebff240695cd20c770546bc71e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.electrosmash.com/pt2399-analysis | |
( | |
SynthDef("pt2399",{ | |
var sndDelay; | |
var snd = MdaPiano.ar(Demand.kr(Impulse.kr(8),0,Drand([60,67,62,65,67,60,72].midicps,inf)),stereo:0.0, | |
gate: LFPulse.kr(8).poll, | |
vel: LFNoise0.kr(5).range(50,70), // varying velocity | |
mul: 1 | |
); | |
// coefficients for one-pole at | |
var theta=2*pi*338/s.sampleRate; | |
var alpha=(theta)/(theta+1); | |
var coef=1-alpha; | |
// Input Stage | |
// The first op-amp will filter the input stage | |
// removing the excess of high harmonics using a Multi-Feedback topology | |
// fc=8.8kHz ( with a Q=0.9 ) | |
// The Multi-Feedback op-amp uses 2 poles (MFB-2) | |
// that give -12dB/octave of attenuation to the high-frequencies. | |
snd = BLowPass.ar(snd,8800,1/0.9); | |
// input added with comparator | |
// snd = snd + LocalIn.ar(2); | |
// (Compander is added to duck feedback?) | |
snd = Compander.ar(LocalIn.ar(2),snd)+snd; | |
// variable delay | |
sndDelay = DelayC.ar(snd,1,MouseX.kr(0.1,1)); // delay line | |
// modulator low-pass filter | |
sndDelay = OnePole.ar(sndDelay,coef); // 338 Hz, -6 dB/octave | |
// limiters?? | |
sndDelay = sndDelay.tanh; | |
sndDelay = Limiter.ar(sndDelay,0.5); | |
// feedback level | |
LocalOut.ar(sndDelay*MouseY.kr(0.1,2,1).poll); | |
// Output Stage | |
// 338 Hz, -6 dB/octave, demodulator low-pass filter | |
snd=OnePole.ar(snd,coef); | |
// a last low pass filter with a cut frequency of 5.8kHz | |
snd = BLowPass.ar(snd,5800,1); | |
snd = Limiter.ar(snd); | |
snd = snd.tanh/2; | |
snd = HPF.ar(snd,50); | |
Out.ar(0,snd); | |
}).play; | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment