" sample volume" in .IT

Started by TheRealByteraver, December 01, 2019, 14:44:10

Previous topic - Next topic

TheRealByteraver

Hi, whilst reading up in ittech.txt I found the following:
Quote
FV = Final Volume (Ranges from 0 to 128). In versions 1.04+, mixed output
      devices are reduced further to a range from 0 to 64 due to lack of
      memory.
Vol = Volume at which note is to be played. (Ranges from 0 to 64)
SV = Sample Volume (Ranges from 0 to 64)
IV = Instrument Volume (Ranges from 0 to 128)
CV = Channel Volume (Ranges from 0 to 64)
GV = Global Volume (Ranges from 0 to 128)
VEV = Volume Envelope Value (Ranges from 0 to 64)

In Sample mode, the following calculation is done:
FV = Vol * SV * CV * GV / 262144               ; Note that 262144 = 2^18
                                                ; So bit shifting can be done.

In Instrument mode the following procedure is used:

1) Update volume envelope value. Check for loops / end of envelope.
2) If end of volume envelope (ie. position >= 200 or VEV = 0FFh), then turn
        on note fade.
3) If notefade is on, then NoteFadeComponent (NFC) = NFC - FadeOut
        ; NFC should be initialised to 1024 when a note is played.
4) FV = Vol * SV * IV * CV * GV * VEV * NFC / 2^41

Now, what is confusing to me is that the sample volume does not set the volume of the channel (not to be confused with the global channel volume)? In a .MOD file, when using the Protracker 0xC "Set volume" command, the parameter of that command will override the sample volume. However, in an .IT file that does not seem to be the case? What defines this "Vol" value in the explanation above then? I can hardly believe it is only initialized with the "Set Volume" command and modifiable with "Volume slide" etc effects? Or does every new note resets the "Vol" to 64 or something?

Saga Musix

Sample Volume is what is called "Global Volume" in OpenMPT's sample editor. It is a fixed factor that cannot be changed at play time, just like Instrument Volume. "Sample Volume" doesn't exist as such in ProTracker files (it would always be 64 there). "Vol" is the volume controlled by the default sample volume and any volume effects (v command and volume slides) in the pattern (apart from volume commands that obviously control other parts of this formula, e.g. channel volume or global volume slides), so this is exactly the same as in MOD files.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

TheRealByteraver

All right, I read your answer a few times, so, just to make sure I understood correctly, I will use an example.

Given sample nr 1 with a default volume of 52, and the following note (Protracker effect encoding, no volume column effect present, tracker is in sample mode):

C-4 01 C32 ( play instrument 1 at note C, 4th octave, and set its volume to 32)

This will:
    - set the volume to 52 (because that is the samples' default volume)
    - then set it to 32 (because of the set volume command)
    ---> will finally result in a channel volume of (32/64)*(52/64)*scale, whereas a .mod / .xm / .s3m replay routine would simply set the volume to (32/64)*scale.

Is the above correct?

(I took the global volume & global channel volume out of the discussion since they are not relevant here I believe)

Saga Musix

What you are describing (both values combined) is the Sample Volume (aka Global Volume in OpenMPT's sample tab) set to 52.
But that's not the same as default volume. If the default volume is 52, then this value will be overridden by the C32 command, just like it would be in ProTracker. There is no different to MOD/XM/S3M, because Sample Volume is an additional parameter not present in those formats.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

TheRealByteraver

Sheesh, I missed the fact that an .IT sample has two volume values (as stored in an .IT file). I suppose the .IT sample volume is used to calibrate the volume of the sample compared to other samples present in the whole module or in the instrument the sample is part of. Makes sense. Thanks for your help! As always, much appreciated.

Saga Musix

That assumption regarding the use case is correct, and it's one more reason to use the IT format. ;)
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.