2015/11/27 03:01:37
rgturner
Can anyone show me an example of how to use the TrackVolume command?  I'm trying to write a CAL that excepts a single parameter; the Volume.  Then the script should loop through each track and set the volume to the volume entered.
 
Can anyone show me a script that can do this?
2015/11/28 04:58:31
promidi
rgturner
Can anyone show me an example of how to use the TrackVolume command?  I'm trying to write a CAL that excepts a single parameter; the Volume.  Then the script should loop through each track and set the volume to the volume entered.
 
Can anyone show me a script that can do this?



Here is a quick script I wrote a little while back to do just that. 

;

(do
    (int Trackno 0)
    (int Volume 127)
    (getInt Volume "Please enter initial volume " 1 127)
     (while (< Trackno 256)
        (do
             (TrackVolume Volume Trackno )
             (++ Trackno)
        )
     )
)
2015/11/28 19:11:25
rgturner
Cool!   Thanks!
2015/11/28 20:16:34
rgturner
Dumb Question.  This will set the volume to a value between 1 & 127. Could this be converted to allow values such 0, -6, -36?
 
I imagine this would required some formula to convert the input value of 6 (for example) to 127
2015/11/28 20:19:36
rgturner
Here's what I have. 
 
Instead of the switch I'd like to use a formula to determine the CalculatedVolume.  Any ideas?
 
Any mathematicians out there?
 
(do
 (include "need20.cal") ; Require version 2.0 or higher of CAL
  
  (int Trackno 0)
  (int Volume -3)
  (int CalculatedVolume)
   
  (getInt Volume "Please enter initial volume " -12 6)
 
  (switch Volume
  6 (= CalculatedVolume 127)
  0 (= CalculatedVolume 101)
  -3 (= CalculatedVolume 88)
  -6 (= CalculatedVolume 75)
  -12 (= CalculatedVolume 53)
 )
 
  (while (< Trackno 256)
   (do
     (TrackVolume CalculatedVolume Trackno )
      (++ Trackno)
   )
 )
)  
2015/11/28 22:21:08
promidi
rgturner
Here's what I have. 
 
Instead of the switch I'd like to use a formula to determine the CalculatedVolume.  Any ideas?
 
(switch Volume
 6 (= CalculatedVolume 127)
 0 (= CalculatedVolume 101)
 -3 (= CalculatedVolume 88)
 -6 (= CalculatedVolume 75)
 -12 (= CalculatedVolume 53)
)


The closest formula you are after is CalculatedVolume = 4.1333333 x (entered volume) + 101.2 with a correlation coefficient (or fit) of 99.91%    As Cal only deals in whole numbers, the results will be a tiny a bit off, but should be close enough for your purpose

Here is the new script

(do
    (int Trackno 0)
    (int Volume 6)
    (getInt Volume "Please enter initial volume between -12 and 6" -12 6)
    (*= Volume  4)
    (+= Volume  101)
    (while (< Trackno 256)
        (do
             (TrackVolume Volume Trackno )
             (++ Trackno)
        )
     )
)
2015/11/29 00:16:54
rgturner
Thanks!  This has been quite helpful.  Not a lot of documentation available.
© 2026 APG vNext Commercial Version 5.1

Use My Existing Forum Account

Use My Social Media Account