Mod Archive Forums

Music Production => Tracking => Topic started by: sverx on September 05, 2008, 12:53:08

Title: Fadeout
Post by: sverx on September 05, 2008, 12:53:08
Hi there. I'm trying to understand how fadeout on instruments (in XM modules) work.
I already understood that fadeout starts on key-off, so when the envelope enters in the release stage. What I don't know is: how the fadeout value affects volume? In the XM documentation I've read the fadeout 'full' value should be 65536 (0x10000) and this value should decrease by the instrument fadeout value every tick.
But in my tests this doesn't happen.
For example If I set in my test instrument the fadeout value to 0x100 the fadeout should be completed in 0x100 (256) ticks but actually -at least in the tracker I'm using, MilkyTracker- the volume fades to 0 way before 256 ticks, say in half of them.
Any idea? Where I'm doing wrong?

Title: Re: Fadeout
Post by: barryvan on September 05, 2008, 13:23:21
First check that Milkytracker's not wrong - try your test under XMPlay and, if you can, FastTracker itself.
Title: Re: Fadeout
Post by: raina on September 08, 2008, 02:32:25
pailes tells me 32768 is the magic number. That's what I use to find out suitable fadeout values based on pattern rows. (32768 / spd*rows) -> hex.
Title: Re: Fadeout
Post by: sverx on September 08, 2008, 10:55:20
pailes tells me 32768 is the magic number. That's what I use to find out a suitable fadeout values based on pattern rows. (32768 / spd*rows) -> hex.

So that's why it sounds like the volume fades in half the time...
Anyway I guess the envelope volume is 0-65536 (as it's written in XM format docs) but -don't know why- the values you set in the instrument will be doubled before being used, which has the same effect.
Well, ok, the most important thing is that it's not a bug I'm replicating into my libs...
Thanks :)

Title: Re: Fadeout
Post by: pailes on September 09, 2008, 11:37:19
First check that Milkytracker's not wrong - try your test under XMPlay and, if you can, FastTracker itself.

MilkyTracker is not wrong :P

So that's why it sounds like the volume fades in half the time...

The value in the official XM format spec (see below) is simply wrong. The only logical conclusion is 32768 instead of 65536.

Quote from: sverx
Anyway I guess the envelope volume is 0-65536 (as it's written in XM format docs) but -don't know why- the values you set in the instrument will be doubled before being used, which has the same effect.

Code: [Select]
FinalVol=(FadeOutVol/65536)*(EnvelopeVol/64)*(GlobalVol/64)*(Vol/64)*Scale;

The envelope points range from 0 to 64. Just as the volume for samples and in the pattern itself.
Title: Re: Fadeout
Post by: sverx on September 09, 2008, 12:07:19
So that's why it sounds like the volume fades in half the time...
The value in the official XM format spec (see below) is simply wrong. The only logical conclusion is 32768 instead of 65536.

I agree :) I'll stick with that now.

The envelope points range from 0 to 64. Just as the volume for samples and in the pattern itself.

Sorry, I meant fadeout volume, of course not envelope volume.

Thanks!  :)