
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:
1data=[635 19.140625
2200 30.28846154
368 58.33333333
4263 26.25
592.62 45.9375
6150.88 32.42647059
7411 22.05
819.07 102.0833333
91056 15.48455056
102043 13.78125
113061 12.35986547
1210000 10.28451493
13449 22.40853659
14];
15
16
17subplot(2,1,1)
18hold off;
19plot(data(:,1),data(:,2),'ok','MarkerFaceColor','k')
20fbind = fitoptions('Method','NonlinearLeastSquares',...
21 'Lower',[100,0,8],...
22 'Upper',[10000,60,20],...
23 'StartPoint',[3800,18,10]);
24ftbind = fittype('a*/(x+b)+c','options',fbind);
25f = fit(data(:,1),data(:,2),ftbind);
26hold on;
27plot(f,'r--')
28xlabel('attack (ms)')
29ylabel('retrigger rate (hz)')
30legend('data',sprintf('fit %2.2f*(x+%2.2f)/(x+%2.2f)^2+%2.2f',f.a,f.b,f.b,f.c))
31subplot(2,1,2)
32hold off;
33plot(data(:,1),data(:,2),'ok','MarkerFaceColor','k')
34hold on;
35plot(f,'r--')
36xlim([0 750])
37ylim([0 150])
38f
39feval(f,10.75)
40xlabel('attack (ms)')
41ylabel('retrigger rate (hz)')
42legend 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.
The SuperCollider code is available as a norns script and also as straight SuperCollider code found on Github: github.com/schollz/supercollider-microtonic.