Porting the Microtonic to SuperCollider
Porting the popular Microtonic VST into SuperCollider.
One of my favorite drum machines is the microtonic vst by soniccharge. I have this VST and I use it a lot, but I was hoping to control it via OSC in SuperCollider so I sought to port it to SuperCollider.
The act of porting is not straightforward and the experience itself was a motivation for this script - it helped me to learn how to use supercollider as I tried to match up sounds between the vst and supercollider using my ear. I learned there is a lot of beautiful magic in microtonic that makes it sounds wonderful, and I doubt I got half of the magic that’s in the actual vst (so this is by no means a replacement). Looking at the resulting engine you might notice some weird equations that are supposed to be approximating the magic behavior in the true microtonic.
One of those weird equations comes for the claps. The clap sound does a smart retriggering of the envelope. To determine the retriggering behavior I would play the original VST and then zoom in on the waveform for the clap.
I did this for various attack times and counted the number of envelope attacks by hand. Then I was able to calculate the retrigger rate vs attack time and plot it out.
It looked pretty close to a multiplicative inverse so I went ahead and tried fitting it in Matlab. I got some points that seem reasonably fit and when I used them it sounded reasonably good! Matlab data for the fit:
data=[635 19.140625 200 30.28846154 68 58.33333333 263 26.25 92.62 45.9375 150.88 32.42647059 411 22.05 19.07 102.0833333 1056 15.48455056 2043 13.78125 3061 12.35986547 10000 10.28451493 449 22.40853659 ]; subplot(2,1,1) hold off; plot(data(:,1),data(:,2),'ok','MarkerFaceColor','k') fbind = fitoptions('Method','NonlinearLeastSquares',... 'Lower',[100,0,8],... 'Upper',[10000,60,20],... 'StartPoint',[3800,18,10]); ftbind = fittype('a*/(x+b)+c','options',fbind); f = fit(data(:,1),data(:,2),ftbind); hold on; plot(f,'r--') xlabel('attack (ms)') ylabel('retrigger rate (hz)') legend('data',sprintf('fit %2.2f*(x+%2.2f)/(x+%2.2f)^2+%2.2f',f.a,f.b,f.b,f.c)) subplot(2,1,2) hold off; plot(data(:,1),data(:,2),'ok','MarkerFaceColor','k') hold on; plot(f,'r--') xlim([0 750]) ylim([0 150]) f feval(f,10.75) xlabel('attack (ms)') ylabel('retrigger rate (hz)') legend off
This equation basically became one line in the SuperCollider code.
Other than that, I followed pretty closely to the description of the Microtonic VST and included all the oscillators, envelopes, and filters specified. There was more guess work in the distortion and the noise filter but I think the result is still very close.