Another related question: how do the cents (like for example frequencies, multiplied by a base frequency) and timecents (multiplied by 1 second to obtain the seconds) differ?
Right now, I calculate both using the very same formula (2 to the power of x/1200). The only difference in my emulation is that one is multiplied by a base frequency (pitch, LFO frequency and the like) and the other by the samplerate (to obtain the time it takes in seconds, like for the envelopes).
Edit: Just improved it a bit.
The key number to hold time scale is properly applied to the hold time instead of using the decay scale incorrectly.
Also, I've adjusted the key number input to the hold/decay scaling to be properly the amount of notes below 60 (as documented) instead of the amount of notes above 60 (which the documentation of "Notes on Implementing SF2/DLS Sound Synthesis" by "Daniel R. Mitchell"). His documentation clearly says:
Scaling can also be made relative to Middle C:
decay = decay + ((key – 60) * scale);
The key-60 is clearly incorrect, as the documentation on the scaling in the Soundfont 2.04 clearly states:
This is the degree, in timecents per KeyNumber units, to which the hold time of the
Volume Envelope is decreased by increasing M […]
Show full quote
This is the degree, in timecents per KeyNumber units, to which the hold time of the
Volume Envelope is decreased by increasing MIDI key number. The hold time at
key number 60 is always unchanged. The unit scaling is such that a value of 100
provides a hold time which tracks the keyboard; that is, an upward octave causes the
hold time to halve. For example, if the Volume Envelope Hold Time were -7973 =
10 msec and the Key Number to Vol Env Hold were 50 when key number 36 was
played, the hold time would be 20 msec.
So that means that the key input is the amount of the key below 60, not above (thus being "60 - key" instead of "key - 60")). I've quickly inputted the example values into a calculator and did the math. The soundfont documentation is indeed correct on that one (otherwise, the math wouldn't check out with the resulting 20ms (actually 19ms when rounded down to whole ms though)).
When I look at it, interestingly enough the text in the Soundfont 2.04 documentation generator description is copy-pasted from the hold description to the decay description for the modulator envelope (keynumToModEnvHold and keynumToModEnvDecay). The only word that changes is "which tracks the keyboard" to become "that tracks the keyboard". Thus it mentions the incorrect sources and destinations for the decay version.
Then, looking at the volume envelope versions, I see the exact same errors (with the which vs that difference and the hold parameter being mentioned in the EnvDecay explanation), although the people that wrote the documentation at least properly replaced the mod/Modulator vs vol/Volume references.