• SONAR
  • Adjusting MIDI tempo by percentage?
2017/01/21 14:16:12
joden
Okay, so I have a midi file that has various tempo changes throughout however overall I want to drop the tempo a bit. Is there a way to do this via,say, percentage? Which would save me having to go in and edit EVERY tempo mapped?
 
Thanks
2017/01/21 16:23:50
promidi
This can be done using a CAL script.  I am pretty sure the following would do it:

(do
    (dword time_pos)
    (int percentage 100)
    (TrackSelect 1 -1)
    (getInt percentage "Please neter percentage change required" 20 200)
    (= time_pos Thru)
    (*= time_pos 100)
    (/= time_pos percentage)
    (EditFitToTime40 time_pos 0 0)
    (TrackSelect 0 -1)
)
2017/01/21 19:28:54
Fred Holmes
Please report back if this works
Thanks,
Fred
2017/01/21 20:37:42
promidi
Unfortunately, Due to a bug in CAL processing in the latest Sonar, the above script does not work.  It gives an "Invalid value".  It does work in Cakewalk Pro Audio 9, however.

In platinum, a way to adjust tempo map by percentage is to use the Fit to Time command. 

1) Do a Select all , Make sure "from" is at the very start of your project. 
2) Then menu item, Process | fit to time. make sure the format is set to MM:SS:FF 
3) Change the value of "New Thru" to be a percentage of what ever was there originally.  Make sure that modify by "tempo map" is selected.

Once you hit "OK", your tempo map should be adjust.


I know this is a convoluted work around, but at least it gives the intended result. The hardest part is working out the new Thru value, which is why I was hoping the CAL script would have worked.
 
2017/01/21 21:47:19
joden
Cool, thanks. I'll give that a go! Sorry for late reply was out working.
2017/01/22 10:07:00
chuckebaby
when is sonar going to create a tempo track where nodes can be added, exc. this would be so much easier than the tempo view.
2017/01/22 11:21:16
dilletant
Not only added and deleted (which is doable now in the tempo view) but modified in various ways! "Scale tempo" has been discussed here on the forum for a long time but in vain.
 
http://forum.cakewalk.com/FindPost/3365873
2017/01/22 14:08:08
SquireBum
promidi
Unfortunately, Due to a bug in CAL processing in the latest Sonar, the above script does not work.  It gives an "Invalid value".  It does work in Cakewalk Pro Audio 9, however.

In platinum, a way to adjust tempo map by percentage is to use the Fit to Time command. 

1) Do a Select all , Make sure "from" is at the very start of your project. 
2) Then menu item, Process | fit to time. make sure the format is set to MM:SS:FF 
3) Change the value of "New Thru" to be a percentage of what ever was there originally.  Make sure that modify by "tempo map" is selected.

Once you hit "OK", your tempo map should be adjust.


I know this is a convoluted work around, but at least it gives the intended result. The hardest part is working out the new Thru value, which is why I was hoping the CAL script would have worked.
 


It appears that the EditFitToTime40 CAL function is the cause of the Invalid Value error.
 
Since the calculations are valid in your script, I think it would be useful to just display the resulting "New Thru" time so a user could use the value in the New Thru field of the Process > Fit To Time... dialog box.  The Format would have to be set to M:B:T in the Fit To Time dialog to use them.
 
I tested a project that I had manually tempo mapped containing 26 tempo changes and it worked OK.
 
I hope you don't mind, but I took the liberty of editing your original script:
 
;;This CAL script calculates a New Thru time based on a user selected change percentage
;;and the current Thru time.
;;CAUTION:  The script assumes that the From time is set to 1:01:000.
(do
    (dword time_pos)
    (int percentage 100)
    (getInt percentage "Please enter percentage change required" 20 200)
    (= time_pos Thru)
    (*= time_pos 100)
    (/= time_pos percentage)
    (pause "New Thru time for " percentage "% tempo scaling is " (meas time_pos) ":" (beat time_pos) ":" (tick time_pos))
)
 
-- Ron
2017/01/23 07:43:28
dilletant
Ron, thank you very much! Unfortunately I could not get desired results with your script. I did a simple test.
Lets say we have some tempo map with initial tempo 120, then some ritenuto which ends up at 112 bpm.
 

 
1:1:000 120
4:2:000 118
4:3:000 116
4:4:000 114
5:1:000 112
 
I want initial tempo to be 114, which is 95% of 120, and change all the following tempos accordingly. Theoretically, new tempo map suppose to be like this:
 
1:1:000 114
4:2:000 112.1
4:3:000 110.19999
4:4:000 108.3
5:1:000 106.39999
 
So, I select bars 1 thru 6 (i.e from the beginning to the end of bar 6), and CAL says new Thru time suppose to be 6:2:50.
But real map after applying the script looks like this:
 
1:1:000 113.71
4:2:000 111.81
4:3:000 109.92
4:4:000 108.02
5:1:000 106.13
2017/01/23 09:07:02
joden
This is cool guys!! @ Ron that is some nice work there!
© 2026 APG vNext Commercial Version 5.1

Use My Existing Forum Account

Use My Social Media Account