No internet connection
  1. Home
  2. How to

How to automate consolidating silence onto start and end of bounces

By @unnamed_976
    2021-01-10 08:03:22.634Z


    I'm a complete novice at programming. I would love to create an app that, finds my Full Mix track, cuts my burnt in mix to length, cuts 6 frames off the tail, cuts 6 frames off the front, then consolidates the clip. Ensuring my UK mixes have 6 frames of silence top and tail. Not sure how to start. Please can you help?

    • 16 replies

    There are 16 replies. Estimated reading time: 12 minutes

    1. samuel henriques @samuel_henriques
        2021-01-10 11:35:36.588Z

        Hello @unnamed_976 ,
        Could you help me by clarifying a bit?

        Selecting your "full mix track" is possible, does the track always have the same name? What is it?

        Cutting it to length, would mean knowing when the audio starts and ends, this might not be possible.

        It looks like you want to add 6 frames f silence to the start and to the end of the clip. But one step you are describing is "cut off 6 frames" do you have 12 frames and need to cut them to 6?

        Adding 6 frames to the start then 6 frames to the end then consolidate, is definitely possible.

        1. samuel henriques @samuel_henriques
            2021-01-10 13:59:55.120Z

            Here's a good start (I think),

            Hope it helps.

            
            
            function setGridViewEnabled() {
                var viewGrid = sf.ui.proTools.mainWindow.groups.whoseTitle.is('Grid/Nudge Cluster').first.buttons.whoseTitle.is('Show Grid Lines').first
                if (viewGrid.value.invalidate().value !== "Selected") viewGrid.elementClick()
            
            
            var gridBtn = sf.ui.proTools.mainWindow.editModeCluster.gridModeButton.invalidate();
            var isAbsolute = gridBtn.title.invalidate().value.indexOf("Absolute") === 0;
            var isSelected = ![
                sf.ui.proTools.mainWindow.editModeCluster.slipModeButton,
                sf.ui.proTools.mainWindow.editModeCluster.shuffleModeButton,
                sf.ui.proTools.mainWindow.editModeCluster.spotModeButton,
            ].some(btn => btn.value.invalidate().value === 'Selected');
            
            if (!isSelected) gridBtn.elementClick();
            if (!isAbsolute) { gridBtn.elementClick(); }
            
            
            sf.ui.proTools.gridSet({
                gridValueName: "1 frame",
                executionMode: "Foreground",
            });
            }
            
            function extendSelectionOnEitherSide(frameCount) {
                setGridViewEnabled();
                sf.keyboard.press({ keys: 'alt+shift+numpad minus', repetitions: frameCount, fast: true });
                sf.keyboard.press({ keys: 'cmd+shift+numpad plus', repetitions: frameCount, fast: true });
            }
            
            
            function main(){
            sf.ui.proTools.appActivate();
            sf.ui.proTools.invalidate();
            
            
            let fullMixTrack = sf.ui.proTools.trackSelectByName({
                names: ["Full Mix"],
                deselectOthers: true,
            });
            
            sf.ui.proTools.selectedTrack.trackScrollToView()
            
            sf.ui.proTools.menuClick({
                menuPath: ["Edit", "Select All"],
            });
            
            extendSelectionOnEitherSide(6)
            
            sf.ui.proTools.menuClick({
                menuPath: ["Edit", "Consolidate Clip"],
            });
            }
            
            
            main()
            
            1. DDavid Poole @David_Poole
                2021-01-12 15:27:05.474Z

                Hi Samuel

                Thanks for your reply.

                The track I burn down to is called FULL MIX in my Pro Tools template.

                I have used a set up previously where you had an option of different lengths to choose from. If you've mixed a 60 second commercial you could hit the 60, if you've mixed a 30 second you would hit another macro, named 30 and so on.

                So the audio would start at 1 hour for example, then the next mix that needs chopping would be at 1 hour 1 minute and so on.

                I would burn my mix in to the FULL MIX track. At this point you would have the audio cut to it's length of 60 seconds or 30 seconds, or 15 seconds etc. For UK we need to take off 6 frames top and tail. So go to end of this clip, go back 6 frames, cut tail. Go to the start of the clip, cursor forwards 6 frames, cut the head off clip. Then consolidate the clip back to its original length, 60, 30 etc. Then move the cursor 1 minute up the timeline and do to the next mix. The next mix might be a different length.

                It could also be useful if you've burnt the the mix into the FULL MIX track but just want to make sure the WAV will be the correct length. You hit the button and it cuts the WAV to the desired, length from a choice of a few lengths.

                Thanks for any help

                Dave

                1. Comment deleted
                  1. samuel henriques @samuel_henriques
                      2021-01-12 16:13:42.318Z2021-01-12 17:01:23.126Z

                      Hey David,
                      I'll try something and let you know

                      samuel

                      1. samuel henriques @samuel_henriques
                          2021-01-12 18:35:29.859Z2021-01-12 19:29:50.298Z

                          Hello David,

                          this will trim 6 frames to start and end, and then consolidate to the original clip duration.
                          And will do it for all selected clips

                          
                          
                          function setGridViewEnabled() {
                              var viewGrid = sf.ui.proTools.mainWindow.groups.whoseTitle.is('Grid/Nudge Cluster').first.buttons.whoseTitle.is('Show Grid Lines').first
                              if (viewGrid.value.invalidate().value !== "Selected") viewGrid.elementClick()
                          
                          
                              var gridBtn = sf.ui.proTools.mainWindow.editModeCluster.gridModeButton.invalidate();
                              var isAbsolute = gridBtn.title.invalidate().value.indexOf("Absolute") === 0;
                              var isSelected = ![
                                  sf.ui.proTools.mainWindow.editModeCluster.slipModeButton,
                                  sf.ui.proTools.mainWindow.editModeCluster.shuffleModeButton,
                                  sf.ui.proTools.mainWindow.editModeCluster.spotModeButton,
                              ].some(btn => btn.value.invalidate().value === 'Selected');
                          
                              if (!isSelected) gridBtn.elementClick();
                              if (!isAbsolute) { gridBtn.elementClick(); }
                          
                              const nudgeCluster = sf.ui.proTools.mainWindow.groups.whoseTitle.is('Grid/Nudge Cluster')
                              const nudgeValue = nudgeCluster.first.textFields.first.invalidate().value.value;
                          
                              if (nudgeValue !== "00:00:00:01.00") {
                          
                                  nudgeCluster.first.popupButtons.whoseTitle.is('Nudge value').first.popupMenuSelect({
                                      menuPath: ["Timecode"],
                                      targetValue: "Enable",
                                  });
                          
                                  sf.ui.proTools.nudgeSet({ value: "00:00:00:01.00" });
                              }
                          
                          }
                          
                          function trimSelectionOnEitherSide(frameCount) {
                              setGridViewEnabled();
                              sf.keyboard.press({ keys: 'alt+shift+numpad plus', repetitions: frameCount, fast: true });
                              sf.keyboard.press({ keys: 'cmd+shift+numpad minus', repetitions: frameCount, fast: true });
                          }
                          
                          
                          function trimAndConsolidatetoToOriginalSelection() {
                          
                              sf.ui.proTools.appActivate();
                          
                              const originalSelection = sf.ui.proTools.selectionGetInSamples()
                          
                              trimSelectionOnEitherSide(6)
                          
                              sf.ui.proTools.menuClick({ menuPath: ["Edit", "Trim Clip", "To Selection"] });
                          
                              sf.ui.proTools.selectionSetInSamples({
                                  selectionStart: originalSelection.selectionStart,
                                  selectionEnd: originalSelection.selectionEnd
                              });
                          
                              sf.ui.proTools.menuClick({ menuPath: ["Edit", "Consolidate Clip"] });
                          
                          }
                          
                          sf.ui.proTools.clipDoForEachClip({
                              action: trimAndConsolidatetoToOriginalSelection,
                              onError: "Continue"
                          });
                          

                          let me know if it works for you

                          1. samuel henriques @samuel_henriques
                              2021-01-12 19:34:59.508Z

                              so far, whats missing from your description is the first step. cut to length,
                              am I right?.

                              So you burn the duration of all videos and get one long clip on the "FULL MIX" track?

                              1. samuel henriques @samuel_henriques
                                  2021-01-12 19:53:43.167Z

                                  Another question, wouldn't you want to have a very short fade in and fade out to avoid a sudden cut?

                      2. D
                        In reply tounnamed_976:
                        David Poole @David_Poole
                          2021-01-13 11:43:49.960Z

                          Hey Samuel,

                          Thank you fo r your replies.

                          I'm such a novice I've no idea what to do with the what I think is code? ;)

                          I would need to cut 6 frames off the start and end of the clip that has been burnt in, then consolidate it back to its original length.

                          I would set an in and out point, potentially by using each video file, but this is not always the case as I'm often sent video files that are too long or short by 1 or 2 frames. In this instance I make a selection around the video files and increase/decrease the length of the selection to the exact length required. Or, I sometimes use the length of the music track if that is the exact length of the mix.

                          Another option I have occasionally used is creating a mute clip, on its own track to the exact length of the mix. Then selecting this clip, to get the selection to the exact length, when burning files in. Maybe this could be of some use?

                          Speak soon
                          Dave

                          1. samuel henriques @samuel_henriques
                              2021-01-13 12:32:21.918Z

                              hey David,

                              Before we move to that one, did you have a chance to try what I sent, to see if it's what you are looking for?

                              Just cut the "FULL MIX" clip to size and then run the script with all selected clips.

                              1. samuel henriques @samuel_henriques
                                  2021-01-13 13:17:24.142Z2021-01-13 15:06:33.256Z

                                  this is what should happen,

                                  https://we.tl/t-ELhcbfJVq4

                              2. D
                                In reply tounnamed_976:
                                David Poole @David_Poole
                                  2021-01-13 15:10:39.953Z

                                  Whatever is on that gif sequence looks great. You would not need fades.

                                  1. samuel henriques @samuel_henriques
                                      2021-01-13 15:16:24.618Z

                                      yep sorry, just changed it to link.

                                      is the script working for you?

                                    • D
                                      In reply tounnamed_976:
                                      David Poole @David_Poole
                                        2021-01-13 15:19:17.621Z

                                        Please excuse my ignorance as a beginner in this field. What would I do with the script?

                                        1. samuel henriques @samuel_henriques
                                            2021-01-13 15:21:29.530Z

                                            no problem,

                                            check out this video from Kitch,

                                          • D
                                            In reply tounnamed_976:
                                            David Poole @David_Poole
                                              2021-01-13 15:47:16.830Z

                                              Thank you so much :) :)

                                              1. D
                                                In reply tounnamed_976:
                                                David Poole @David_Poole
                                                  2021-01-13 17:38:49.711Z

                                                  Just trying it out now. It is really exciting (well, for me anyway, probably a niche area for excitement)