Thursday, October 11, 2012

.it vibrato.

Been working on a hopefully-sample-accurate-once-i-get-stuff-sorted .it player. Currently aiming for IT 2.11 accuracy, as that has the nicest .wav writer in terms of being able to get sample-accurate. Furthermore, IT 2.11 isn't that much different in its playroutine from IT 2.14 patch 5 (most notably it doesn't have filters, but tbqh I don't care about that yet).

Vibrato has proven to be the biggest pain in the ass so far to get right (barring maybe Amiga slides). The most annoying thing is that you basically need bat ears to tell the difference between what IT spits out and what your average Joe Playroutine spits out.

Firstly, determine whether you are using Amiga slides or linear slides. I haven't fully sussed out Amiga slides yet, but my estimate of AMICLK=8363*1712*64; freq = (AMICLK/(AMICLK/freq - extra_fine_slide_up*64)); isn't too shabby, but tends to be off by 1Hz in a few places and I honestly don't know why (I think this happens with down slides but not up slides, don't ask me why).

Now, you update the offset by the speed FIRST. Then:

v = vib_depth*table_to_use[vib_offs];
v += (v < 0 ? -7 : 8);
v = (v < 0 ? -((-v)>>4) : v>>4);


(If you can make this more elegant, please do!)

If you're using Amiga slides, do an extra fine slide by v.
If you're using Linear slides, then, if abs(v) < 15, do an extra fine slide by v, otherwise do a normal slide by v/4 (clamp to 0).

Now, onto retriggering.

I don't yet know what retriggers vibrato, other than this case:

C-5 01 .. Hxx <-- going as usual
... .. .. Hxx

... .. .. Hxx

... .. .. Hxx

... .. .. Hxx

C-5 02 .. Hxx <-- retriggers! (if you remove the Hxx, it will NOT retrigger.)

C-5 01 .. Hxx

But the most important thing is it doesn't normally retrigger on a new note.