ModPlug Central

OpenMPT => Development Corner => Topic started by: inhahe on June 12, 2022, 10:01:21

Title: how do the vibrato depth units work in xm files?
Post by: inhahe on June 12, 2022, 10:01:21
how does the value for vibrato depth in an xm file translate to actual frequency max/min or whatever values? I can't find this anywhere. Thanks.
Title: Re: how do the vibrato depth units work in xm files?
Post by: Saga Musix on June 12, 2022, 11:27:06
When hovering the input field, you will see the corresponding depth in cents. There is no translation to frequency in Hertz because that depends on which note you play. The maximum depth (15) gives you approximately +/- 23 cents.
Title: Re: how do the vibrato depth units work in xm files?
Post by: inhahe on June 12, 2022, 18:33:01
oh, thanks. Yeah, I thought the max/min would depend on the note you play, I was hoping someone would give me a formula. I did mess with openmpt a little to see if I could find a place where I input a depth and see if it shows me any information about it, but I couldn't figure out how. I also tried FastTracker 2.
Title: Re: how do the vibrato depth units work in xm files?
Post by: Saga Musix on June 12, 2022, 18:48:18
Ah, I should also add that I assumed you were asking about instrument auto vibrato. That has a resolution of 1/64th of a semitone, no matter if linear slides are enabled or not (which results in the +/-23 cents I talked about). The pattern effect (4xy) has a resolution of 1/8th of a semitone in linear slides mode, so at the maximum depth (15) it spans approximately +/-2 semitones. When linear frequency slides are disabled however, the depth indeed changes depending on which note you play, like in the MOD format. Expressing that in a formula is rather complex as it requires explaining the entire concept behind pitch in the MOD format. Before I start digging into that, let me know if that is actually relevant for you or if linear slide mode is enough to know about.
Title: Re: how do the vibrato depth units work in xm files?
Post by: inhahe on June 12, 2022, 19:10:25
I want my program to support any valid xm file, so I guess I need to know about both the linear and Amiga modes. By the way, is the xm file format documented anywhere in more depth than in 'The Unofficial XM File Format Specification' ( https://www.celersms.com/doc/XM_file_format.pdf ) ?
Title: Re: how do the vibrato depth units work in xm files?
Post by: Saga Musix on June 12, 2022, 20:58:31
That PDF is an unofficial source, and while it looks fairly complete* it is definitely not without errors. The period to frequency conversion on the last page is probably what you're interested in. But it claims that most players use floating-point calculation for that formula, which is news to me. Most widely known module player code bases are so old that using floating-point math wasn't really viable when they were written, so typically they use integer math like OpenMPT does.

* don't expect full documentation of XM effects in any such document. A lot of effect implementations in Fasttracker 2 have subtle bugs, and describing those bugs in plain text is often really a lot more complicated than just directly looking at the code instead. You may want to look at 8bitbubsy's ft2play (https://github.com/8bitbubsy/ft2play/) which is a direct C port from the original FT2 assembly, so its effect implementations are highly accurate. Looking there is probably better than trying to describe what the effects do in detail.