I am trying to write a script that will build on the Identify Beat function in Pro Tools.
I like to create beat maps for songs that haven't been recorded with a click track and its a fairly labourious task that I would like to simplify
At the moment when you have the dialogue box open it tells you where you are in bars, beats and ticks, you manually enter the bar number ans move on. What I would like to do is somehow tell it to go to the nearest bar number in relation to where it is. e.g if the downbeat is 2:4:889 it would move to 3:1:000 and cosequently if the bar number was 2:1:060 it would move it back to 2:1:000.
I have had some luck with a Macro but that can only get it to go in one direction
My scripting knowledge is limited so a push in the right direction would be of immense help.
Thanks
- Kitch Membery @Kitch2020-03-02 09:53:59.078Z2020-03-02 10:04:23.638Z
Hi Andrew,
I'm sure there is more elegant way to do this... but the following script should round bar values up/down;
You will however have to provide the number of beats in the bar for it to work.
//Bars:Beats:SubBeats var barsAndBeatsVariable = "2:1:060"; //How many beats in bar? var numberOfBeatsInEachBar = 4; //------------Split out Bars Beats and Sub Beats------------// //Split barsAndBeatsVariable variable into an array. var barsAndBeatsSplitArray = barsAndBeatsVariable.split(":"); //Bars var selectedBars = Number(barsAndBeatsSplitArray[0]); //Beats var selectedBeats = Number(barsAndBeatsSplitArray[1]); //Sub Beats var selectedSubBeats = Number(barsAndBeatsSplitArray[2]); //-----------------------Calculations-----------------------// //Check to see if the Sub Beats are greater than or equal to 500 if (selectedSubBeats >= 500) { selectedBeats = selectedBeats + 1; }; //Check to see if Beats value is greater than or equal to half the amounts of beats in a bar. if (selectedBeats >= (numberOfBeatsInEachBar / 2)) { selectedBars = selectedBars + 1; }; var roundedBarNumber = String(selectedBars) + ":1:000"; log(roundedBarNumber);
Hope this helps :-)
K - AIn reply toAndrew_Downes⬆:Andrew Downes @Andrew_Downes
Hi Kitch
Thanks for your response, I have a couple of questions.
Do I copy and paste the whole script in, or is there just a part I need? (calculations)
When I run the script as it is I just get a script log message from Soundflow and it isnt doing anything, see question 1!!
CheersKitch Membery @Kitch2020-03-03 10:47:57.829Z2020-03-03 11:20:23.515Z
Andrew,
Sorry to confuse you.... The above script was just for the workings of rounding the bars up or down.
I did not have Pro Tools open when I wrote the script. This following script is a starting point (but needs to be fleshed out to accommodate Ticks calculations based on note length but will currently work with quarter notes).
The script does the following once triggered;
- Opens and waits for the "Identify Beat" window.
- Retrieves the current "Bar | Beat | Ticks" location.
- Retrieves the number of beats in the bar.
- Rounds the Bar value up or down.
- Enters the new Bar number in Location Text box.
- Clicks OK
//Activate Pro Tools sf.ui.proTools.appActivateMainWindow(); //Open Identify Beat window sf.ui.proTools.menuClick({ menuPath: ["Event", "Identify Beat..."], }); //Wait for the Identify Beat window to open sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor(); //Retreive the number of beats in each bar var numberOfBeatsInEachBar = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.allItems[1].value.value; //Get Bars:Beats:Ticks var barsAndBeatsVariable = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first.value.value; //Split barsAndBeatsVariable variable into an array. var barsAndBeatsSplitArray = barsAndBeatsVariable.split("|"); //Bars Variable var selectedBars = Number(barsAndBeatsSplitArray[0]); //Beats Variable var selectedBeats = Number(barsAndBeatsSplitArray[1]); //Ticks Variable var selectedTicks = Number(barsAndBeatsSplitArray[2]); //Evaluate Ticks if (selectedTicks >= (960/2)) { selectedBeats = selectedBeats + 1; }; //Check to see if Beats value is greater than or equal to half the amounts of beats in a bar. if (selectedBeats >= (Number(numberOfBeatsInEachBar) / 2)) { selectedBars = selectedBars + 1; }; //Set up variable for rounded bar number var roundedBarNumber = String(selectedBars); //Update rounded bar number sf.keyboard.type({ text: roundedBarNumber, }); //Wait sf.wait({intervalMs:300}); //Click OK sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for Identify Beat window to disappear sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor({ waitType: "Disappear", });
Hope that helps.
Rock on
KitchKitch Membery @Kitch2020-03-03 11:28:39.388Z
Here is a breakdown of the Ticks vs Note Value I found in the Pro Tools manual.
I'd have to spend a bit of time however to get it working with all the different note values.
K- AAndrew Downes @Andrew_Downes
Thank you so much! This is exactly what I was hoping for.
I think I can work out what would be needed from here for the different note values.
AwesomeKitch Membery @Kitch2020-03-04 01:10:14.149Z
You're welcome mate!
Twas a great idea for a script :-)
- AAndrew Downes @Andrew_Downes
Yes,
I've been trying to come up with something that will make this process more automated for years. This is going to save so much time as it has become a 2 button process.
I may well put it into a package and post it in the store.Kitch Membery @Kitch2020-03-04 01:51:35.952Z2020-03-04 02:08:00.133Z
@chrscheuer mate!
In the script above I had to use the following code to enter a variable into the Identify Beat "Location" field in Pro Tools. I tried using using the "Set Value of Text Area" and "Set Value of Text Field with Text Area" with no luck.
//Update rounded bar number sf.keyboard.type({ text: roundedBarNumber, }); //Wait sf.wait({intervalMs:300});
Is there a way to do this without the the "sf.keyboard.type" code to avoid having to insert a wait after it?
As always... Thanks in advance.
KChristian Scheuer @chrscheuer2020-03-04 02:34:19.355Z
I'm not by a PT machine right now, but if it's anything like the other time signature fields in PT then you're doing it right by simulating keyboard. However, instead of the wait, you can insert code to check if the value of the Location field has updated yet.
Once it has, you can move on. This check can be in a while loop with a small wait value.Kitch Membery @Kitch2020-03-04 04:41:21.221Z
Great Idea. Would I do it like this?
var barsAndBeatsVariable = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first.value.value; //Wait for Bars and Beats Location field to update while (barsAndBeatsVariable == barsAndBeatsVariable) { sf.wait({ intervalMs: 100 }); };
Or is there code that waits for a text field to update?
Christian Scheuer @chrscheuer2020-03-04 04:51:30.802Z
Almost. Your while loop as stated here would run indefinitely since you're checking the variable against itself.
The loop would need to update the variable to the current state and check if it matches the desired output.So, pseudo code here, but something like this:
sf.keyboard.type({ text: roundedBarNumber, }); var textField = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first; //Wait for Bars and Beats Location field to update var i = 0; while (textField.value.invalidate().value !== roundedBarNumber) { sf.wait({ intervalMs: 100 }); if (i++ > 10) throw `Value didn't update after 10 attempts. Value entered: "${roundedBarNumber}". Value found: "${textField.value.value}"`; };
Christian Scheuer @chrscheuer2020-03-04 04:52:23.934Z
Note that some fields in Pro Tools come back differently from how you type them, so the logic might need to be modified slightly to take that into account.
Kitch Membery @Kitch2020-03-04 04:53:45.726Z
Thanks mate. I’ll give it a go tonight.
- In reply tochrscheuer⬆:
Kitch Membery @Kitch2020-03-04 08:06:16.637Z
Yes @chrscheuer... you were right. Here is what solved it.
//Update rounded bar number sf.keyboard.type({ text: roundedBarNumber, }); var textField = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first; //Wait for Bars and Beats Location field to update var i = 0; while (textField.value.invalidate().value.trim() !== (roundedBarNumber+"| 1| 000")) { sf.wait({ intervalMs: 100 }); if (i++ > 10) throw `Value didn't update after 10 attempts. Value entered: "${roundedBarNumber}". Value found: "${textField.value.value}"`; };
I trim the text field value as it had a bunch of blank space at the front ie " 5| 1| 000".
This works a treat removing the lag induced by the wait command added.
Thanks again for providing the best tech support that has ever existed!
- In reply toAndrew_Downes⬆:
Kitch Membery @Kitch2020-03-04 04:08:35.757Z
@Andrew_Downes What does the second button do?
- AAndrew Downes @Andrew_Downes
The 2nd button is actually the Identify Beat command, the 1st is Tab To Transient.
- In reply toAndrew_Downes⬆:
Kitch Membery @Kitch2020-03-04 08:15:21.882Z
@Andrew_Downes... Here is an updated script that eliminates the wait for the variable to be typed into the Location field.
A subtle update, but will make the script a little more stable. :-)
//Activate Pro Tools sf.ui.proTools.appActivateMainWindow(); //Open Identify Beat window sf.ui.proTools.menuClick({ menuPath: ["Event", "Identify Beat..."], }); //Wait for the Identify Beat window to open sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor(); //Retreive the number of beats in each bar var numberOfBeatsInEachBar = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.allItems[1].value.value; //Get Bars:Beats:Ticks var barsAndBeatsVariable = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first.value.value; //Split barsAndBeatsVariable variable into an array. var barsAndBeatsSplitArray = barsAndBeatsVariable.split("|"); //Bars Variable var selectedBars = Number(barsAndBeatsSplitArray[0]); //Beats Variable var selectedBeats = Number(barsAndBeatsSplitArray[1]); //Ticks Variable var selectedTicks = Number(barsAndBeatsSplitArray[2]); //Evaluate Ticks if (selectedTicks >= (960 / 2)) { selectedBeats = selectedBeats + 1; }; //Check to see if Beats value is greater than or equal to half the amounts of beats in a bar. if (selectedBeats >= (Number(numberOfBeatsInEachBar) / 2)) { selectedBars = selectedBars + 1; }; //Set up variable for rounded bar number var roundedBarNumber = String(selectedBars); //Update rounded bar number sf.keyboard.type({ text: roundedBarNumber, }); //Create variable for while loop var textField = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first; //Wait for Bars and Beats Location field to update var i = 0; while (textField.value.invalidate().value.trim() !== (roundedBarNumber+"| 1| 000")) { sf.wait({ intervalMs: 50 }); if (i++ > 10) throw `Value didn't update after 10 attempts. Value entered: "${roundedBarNumber}". Value found: "${textField.value.value}"`; }; //Click OK sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for Identify Beat window to disappear sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor({ waitType: "Disappear", });
- AAndrew Downes @Andrew_Downes
Thank you, this is even faster!
Kitch Membery @Kitch2020-03-06 03:55:47.002Z
My pleasure mate. When I get a chance I'll make another script that rounds the beats only.
K
Andrew Scheps @Andrew_Scheps
Hi Kitch,
Here's one that just does the beats. I've commented where I've changed your code. One big timesaver is that Pro Tools automatically increments the bar if you type a number for the beats higher than the number of beats in the bar. So, typing "124.5" is automatically changed to "125|1" if your meter is 4 beats to the bar. This means the only data entry check is that the ticks have been zeroed out, which PTs does as soon as you start typing in the dialog.
//Activate Pro Tools sf.ui.proTools.appActivateMainWindow(); //Open Identify Beat window sf.ui.proTools.menuClick({ menuPath: ["Event", "Identify Beat..."], }); //Wait for the Identify Beat window to open sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor(); //Retrieve the number of beats in each bar - NOTE: This is no longer needed, Pro Tools will automatically increment the bar if you type one beat more than the number of beats in the bar //var numberOfBeatsInEachBar = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.allItems[1].value.value; //Get Bars:Beats:Ticks var barsAndBeatsVariable = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first.value.value; //Split barsAndBeatsVariable variable into an array. var barsAndBeatsSplitArray = barsAndBeatsVariable.split("|"); //Bars Variable var selectedBars = Number(barsAndBeatsSplitArray[0]); //Beats Variable var selectedBeats = Number(barsAndBeatsSplitArray[1]); //Ticks Variable var selectedTicks = Number(barsAndBeatsSplitArray[2]); //Evaluate Ticks if (selectedTicks >= (960 / 2)) { selectedBeats = selectedBeats + 1; }; //Check to see if Beats value is greater than or equal to half the amounts of beats in a bar. NOTE: Not needed, see above //if (selectedBeats >= (Number(numberOfBeatsInEachBar) / 2)) { // selectedBars = selectedBars + 1; //}; //Set up variable for rounded bar number (text entry in dialog only) var roundedBarNumber = String(selectedBars + "." + selectedBeats); //Update rounded bar number sf.keyboard.type({ text: roundedBarNumber, }); //Create variables for while loop var textField = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first; var roundedDisplayNumber = String(selectedBars + "| " + selectedBeats); //Wait for Bars and Beats Location field to update var i = 0; while (textField.value.invalidate().value.trim() !== (roundedDisplayNumber+"| 000")) { //Make sure Pro Tools took the input and zeroed out the ticks sf.wait({ intervalMs: 50 }); if (i++ > 10) throw `Value didn't update after 10 attempts. Value entered: "${roundedBarNumber}". Value found: "${textField.value.value}"`; }; //Click OK sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for Identify Beat window to disappear sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor({ waitType: "Disappear", });
Kitch Membery @Kitch2020-03-10 11:35:46.648Z
Andrew you legend!...
If only I had have known that before I wrote this script last night Hahahhahaaa :-)
//Activate Pro Tools sf.ui.proTools.appActivateMainWindow(); //Open Identify Beat window sf.ui.proTools.menuClick({ menuPath: ["Event", "Identify Beat..."], }); //Wait for the Identify Beat window to open sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor(); //Retreive the number of beats in each bar var numberOfBeatsInEachBar = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.allItems[1].value.value; log(numberOfBeatsInEachBar); //Get Bars:Beats:Ticks var barsAndBeatsVariable = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first.value.value; //Split barsAndBeatsVariable variable into an array. var barsAndBeatsSplitArray = barsAndBeatsVariable.split("|"); //Bars Variable var selectedBars = Number(barsAndBeatsSplitArray[0]); //Beats Variable var selectedBeats = Number(barsAndBeatsSplitArray[1]); //Ticks Variable var selectedTicks = Number(barsAndBeatsSplitArray[2]); //Evaluate Ticks if (selectedTicks >= (960 / 2)) { selectedBeats = selectedBeats + 1; }; //Check to see if Beats value is greater than or equal to half the amounts of beats in a bar. if (selectedBeats > Number(numberOfBeatsInEachBar)) { selectedBars = selectedBars + 1; selectedBeats = 1; }; //Set up variable for rounded bar number var roundedBarNumber = String(selectedBars); //Set up variable for rounded bar number var roundedBeatNumber = String(selectedBeats); //Create location field string var locationBarsBeatsRounded = roundedBarNumber + "|" + roundedBeatNumber + "|000" //Update rounded Bars number sf.keyboard.type({ text: roundedBarNumber, }); //Move to next column sf.keyboard.press({ keys: "period", fast: true, }); //Update rounded Beats number sf.keyboard.type({ text: roundedBeatNumber, }); //Create variable for while loop var textField = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first; //Wait for Bars and Beats Location field to update var i = 0; while (textField.value.invalidate().value.replace(/\s/g,'') !== locationBarsBeatsRounded) { sf.wait({ intervalMs: 50 }); if (i++ > 10) throw `Value didn't update after 10 attempts. Value entered: "${roundedBarNumber}". Value found: "${textField.value.value}"`; }; //Click OK sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for Identify Beat window to disappear sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor({ waitType: "Disappear", });
Am going to put a collection of these scripts together to do the following;
Round Bar
Round Bar Up
Round Bar Down
Round Beat
Round Beat Up
Round Beat DownBeat mapping heaven!
Andrew Scheps @Andrew_Scheps
I’ve got a better way to do all of this, I’m out for a couple hours but I’ll post something tonight!
- In reply toAndrew_Downes⬆:Andrew Scheps @Andrew_Scheps
Ok!
First of all, Kitch, there was a small problem with your current script:
It only works for quarter note based meters and rounds up from the wrong beat.For instance:
meter: 4/4
selection 4|1|750
your script will first round up to 4|2|000
then round up again to 5|1|000 when it should round down to 4|1|000The wrong beat thing is easily fixed, but then I thought it's not as robust with weird meters as it should be. So, in thinking about the best way to do it I've come up with a method that will work no matter how many beats per bar and no matter what type of beats they are.
Basically, figure out how many ticks per bar, find out how many ticks into the current bar the selection is and then round based on that.
//Activate Pro Tools sf.ui.proTools.appActivateMainWindow(); //Open Identify Beat window sf.ui.proTools.menuClick({ menuPath: ["Event", "Identify Beat..."], }); //Wait for the Identify Beat window to open sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor(); //The number of ticks in a 4/4 bar, which gives you a way to easily get ticks per beat regardless of the type of beat. const ticksMultiplier = 3840 //Retrieve the number of beats in each bar and setup all the variables we need to do the rounding var numberOfBeatsInEachBar = Number(sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.allItems[1].value.value); var typeOfBeats = Number(sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.allItems[2].value.value); var ticksPerBeat = ticksMultiplier/typeOfBeats; var ticksPerBar = numberOfBeatsInEachBar * ticksPerBeat; //Get Bars:Beats:Ticks var barsAndBeatsVariable = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first.value.value; //Split barsAndBeatsVariable variable into an array. var barsAndBeatsSplitArray = barsAndBeatsVariable.split("|"); //Bars Variable var selectedBars = Number(barsAndBeatsSplitArray[0]); //Beats Variable var selectedBeats = Number(barsAndBeatsSplitArray[1]); //Ticks Variable var selectedTicks = Number(barsAndBeatsSplitArray[2]); // Where are we in the bar? //Evaluate Ticks var selectedInTicks = selectedBeats * ticksPerBeat + selectedTicks; if (selectedInTicks >= ticksPerBar/2) { selectedBars = selectedBars + 1; }; //Set up variable for rounded bar number var roundedBarNumber = String(selectedBars); //Update rounded bar number sf.keyboard.type({ text: roundedBarNumber, }); //Create variable for while loop var textField = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first; //Wait for Bars and Beats Location field to update var i = 0; while (textField.value.invalidate().value.trim() !== (roundedBarNumber+"| 1| 000")) { sf.wait({ intervalMs: 50 }); if (i++ > 10) throw `Value didn't update after 10 attempts. Value entered: "${roundedBarNumber}". Value found: "${textField.value.value}"`; }; //Click OK sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for Identify Beat window to disappear sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor({ waitType: "Disappear", });
Andrew Scheps @Andrew_Scheps
And with only a little modification here's one that rounds to the beat, regardless of the meter:
//Activate Pro Tools sf.ui.proTools.appActivateMainWindow(); //Open Identify Beat window sf.ui.proTools.menuClick({ menuPath: ["Event", "Identify Beat..."], }); //Wait for the Identify Beat window to open sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor(); //The number of ticks in a 4/4 bar, which gives you a way to easily get ticks per beat regardless of the type of beat. const ticksMultiplier = 3840 //Retrieve the type of beats in each bar and setup all the variables we need to do the rounding var typeOfBeats = Number(sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.allItems[2].value.value); var ticksPerBeat = ticksMultiplier/typeOfBeats; //Get Bars:Beats:Ticks var barsAndBeatsVariable = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first.value.value; //Split barsAndBeatsVariable variable into an array. var barsAndBeatsSplitArray = barsAndBeatsVariable.split("|"); //Bars Variable var selectedBars = Number(barsAndBeatsSplitArray[0]); //Beats Variable var selectedBeats = Number(barsAndBeatsSplitArray[1]); //Ticks Variable var selectedTicks = Number(barsAndBeatsSplitArray[2]); //Evaluate Ticks if (selectedTicks >= (ticksPerBeat / 2)) { selectedBeats = selectedBeats + 1; }; //Set up variable for rounded bar number (text entry in dialog only) var roundedBarNumber = String(selectedBars + "." + selectedBeats); //Update rounded bar number sf.keyboard.type({ text: roundedBarNumber, }); //Create variables for while loop var textField = sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.first; var roundedDisplayNumber = String(selectedBars + "| " + selectedBeats); //Wait for Bars and Beats Location field to update var i = 0; while (textField.value.invalidate().value.trim() !== (roundedDisplayNumber+"| 000")) { //Make sure Pro Tools took the input and zeroed out the ticks sf.wait({ intervalMs: 50 }); if (i++ > 10) throw `Value didn't update after 10 attempts. Value entered: "${roundedBarNumber}". Value found: "${textField.value.value}"`; }; //Click OK sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for Identify Beat window to disappear sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.elementWaitFor({ waitType: "Disappear", });
Kitch Membery @Kitch2020-03-10 18:36:28.456Z
Nice one Andrew!
I was trying to work out how I'd approach the script to work for all meters and these lines you added are sensational!
//The number of ticks in a 4/4 bar, which gives you a way to easily get ticks per beat regardless of the type of beat. const ticksMultiplier = 3840 //Retrieve the type of beats in each bar and setup all the variables we need to do the rounding var typeOfBeats = Number(sf.ui.proTools.windows.whoseTitle.is('Add Bar | Beat Marker').first.textFields.allItems[2].value.value); var ticksPerBeat = ticksMultiplier/typeOfBeats;
Thanks Mate!
K- AAndrew Downes @Andrew_Downes
This is some nice work here guys! I have some questions though.
Andrew S, with your latest version of the script. will it round up or down to the nearest note value e.g 1.2.525 would move to 1,2,480 or is it still working on find the whole bar number?
If it's still working on whole bar numbers, why would the meter differences matter?Andrew Scheps @Andrew_Scheps
Hi Andrew. There is one script that always rounds to the bar and one that always rounds to the beat. Neither of them will round between beats. It will round to whatever beat division is in the denominator of the meter, so any meter with a 4 on the bottom rounds to quarter notes etc.
If your meter was 1/4 note based and you wanted to round to 1/8 notes I think I’d actually change the meter. For instance if you were in 3/4, change the meter to 6/8 and then run the script that rounds to the beat. Obviously this is a pain if you have multiple meter events...
The reason the meter matters is to figure out how many ticks there are per bar or per beat depending which you are rounding to. For example if you are in an 1/8 note based meter anything over 240 rounds to the next beat, but in a 1/4 note meter it’s anything over 480.
- AAndrew Downes @Andrew_Downes
Yes, of course. Thank you.
Its a real time saver eh!!
- In reply toKitch⬆:
Kris Crunk @Kris_Crunk
I used both of Andrews' scripts with tab to transient to map out a rubato piano thing I did really quick
Digging into this more to see if there is a faster way or a way to automate what I was doing
Raphael Sepulveda @raphaelsepulveda2021-02-11 00:05:06.519Z
Wow, your computer is so fast the beat identify window can't even be seen. Crazy!
Kris Crunk @Kris_Crunk
I was using my mouse for video purposes - it goes even fast when I touch the screen
Raphael Sepulveda @raphaelsepulveda2021-02-11 00:09:10.649Z
Hell yeah!
Kris Crunk @Kris_Crunk
Mac Pro - 16 core - 160 gigs of ram
Got it a little over a year ago - thankfully before covid hit.
Kitch Membery @Kitch2021-02-11 01:47:14.434Z
Epic, so fast!!! I'm waiting for the next M1=>M2 :-)
Kris Crunk @Kris_Crunk
Now we just have to get the entire process automated ;)