Author Topic: " sample volume" in .IT  (Read 196 times)

Offline TheRealByteraver

  • Inspired artist
  • **
  • Posts: 52
  • Operating System: Windows 7 Pro 64 bit
" sample volume" in .IT
« on: December 01, 2019, 14:44:10 »
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?

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,792
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: " sample volume" in .IT
« Reply #1 on: December 01, 2019, 16:05:21 »
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.

Offline TheRealByteraver

  • Inspired artist
  • **
  • Posts: 52
  • Operating System: Windows 7 Pro 64 bit
Re: " sample volume" in .IT
« Reply #2 on: December 01, 2019, 16:59:03 »
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):

Code: [Select]
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)

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,792
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: " sample volume" in .IT
« Reply #3 on: December 01, 2019, 17:09:53 »
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.

Offline TheRealByteraver

  • Inspired artist
  • **
  • Posts: 52
  • Operating System: Windows 7 Pro 64 bit
Re: " sample volume" in .IT
« Reply #4 on: December 01, 2019, 17:32:33 »
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.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,792
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: " sample volume" in .IT
« Reply #5 on: December 01, 2019, 18:16:37 »
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.