No internet connection
  1. Home
  2. How to

Select Previous Clip?

By Reid Caulfield @Reid_Caulfield
    2021-07-12 21:50:07.173Z

    I'm sure this is simple, but since there doesn't seem to be a menu item in Pro Tools for the "Select Previous Clip" key combination (Control-Option-Tab), how can I perform this function in Soundflow?

    • 6 replies
    1. You can always use a "Press Keys" action to simulate keystrokes. I think that's what you'd have to do in this case.

      Note, if this is part of a macro to iterate through selected clips, we have specific actions for this (make sure to search the forum, there are many examples of iterating through clips).

      1. RReid Caulfield @Reid_Caulfield
          2021-07-13 05:18:59.637Z

          Thank you, Christian. That's what I ended up doing. I'm actually not trying to iterate clip selection, but separate a clip at x timecode, then again at x timecode + 20 seconds, and then select (backwards) the clip I just created to perform an additional operation on it. There are issues with this methodology, for example if there's a pre-existing edit within the new 20 second clip.

          The other way I thought of doing it was to enter the in and out timecode values in one of the timecode windows, and then Separate and finally perform the final operation, and I can see how this might be done using variables, but I'm not quite there yet.

          1. Here's an example of restoring the selection, sample accurate:

            function withSelectionRestore({ callback }) {
                let selectionInSamples;
            
                try {
                    //Save the current selection
                    selectionInSamples = sf.ui.proTools.selectionGetInSamples();
            
                    //Call the callback
                    callback();
                } finally {
                    //Finally, restore the selection
                    sf.ui.proTools.selectionSetInSamples({
                        selectionStart: selectionInSamples.selectionStart,
                        selectionEnd: selectionInSamples.selectionEnd,
                    });
                }
            }
            
            //Here, do something
            
            withSelectionRestore({
                callback: () => {
                    //Here, do some things. You can change the selection in here, and after you're done it'll be restored to what it was before
            
            
                }
            });
            

            However, in your case, why not:

            • Make the selection you want
            • Separate (this will create a separation on the start and at the end of the current selection, keeping the selection)

            Then you don't need to select the clip afterwards.

            1. In this type of workflow, where there are multiple ways of achieving the desired result, it's often a good idea to talk more about what you're trying to achieve overall, since that may help us point you in the right direction in terms of choosing which of the methods is more suited for being automated :)

              Are you building something for automating background cutting?

              1. RReid Caulfield @Reid_Caulfield
                  2021-07-14 00:26:00.979Z

                  Thank you Christian. I'm building a deck for a particular network client who send me full episodes for pre-air final audio QC. I deliver a spreadsheet to them detailing issues, and they come back with review file requests. The review files need to be 20 seconds long, 10 seconds on each side of the issue in question. So in this example, what I have working is the following:

                  1. Invoke the Macro and enter the target timecode (no prompt yet LOL);
                  2. Drop a memory location marker at the target location and name it;
                  3. Move the cursor 10 seconds earlier in the timeline and separate;
                  4. Move the cursor 20 seconds later in the timeline and separate;
                  5. Select Previous clip (the clip that was just created;
                  6. Call up the Bounce to Disk window and invoke a custom preset for Quicktime h.264 + aac output;
                  7. Open the bounce folder and the target folder where the bounced file needs to be moved to. I do the actual move myself.

                  Again, if there is a pre-existing cut somewhere in the 20 second clip, then Select Previous Clip won't work. The nice thing about this method is that I don't need timecode in and out times, just the exact issue target time, and I don't want to give that up.

                  1. samuel henriques @samuel_henriques
                      2021-07-14 22:40:16.045Z

                      Hello Reid,

                      Christian might be busy working on some new soundFlow features, I can try to help.

                      Here is something that should do what you are asking.
                      I presume you are working on 48k, if not, change the number 480000 to whatever is 10 seconds in samples.

                      
                      
                      function userTimeCode() {
                          function checkTimeCodeValid(value) {
                              /////https://gist.github.com/allensarkisyan/5441601
                              // Assumes the frame rate is 23.98, 24, 25, 29.97 NDF, or 30
                              var isValidSMPTETimeCode = /(^(?:(?:[0-1][0-9]|[0-2][0-3]):)(?:[0-5][0-9]:){2}(?:[0-2][0-9])$)/;
                              if (!isValidSMPTETimeCode.test(value)) {
                                  alert("This Time Code is Not Valid!")
                                  return
                              } else {
                                  return value
                              };
                          };
                      
                          function stringToTc(string) {
                              let convert
                              if (string.indexOf(":") != -1) {
                                  convert = string
                              } else {
                                  convert = string.match(/.{1,2}/g).join(":");
                              };
                              return convert
                          };
                      
                      
                          let validTimeCode
                          while (true) {
                      
                              let promptString = prompt(`Please enter the timecode,\nwith or without colon (:)`);
                      
                              if (promptString === undefined) {
                      
                                  throw 'Prompt for timecode canceled.'
                      
                              } else if (promptString) {
                      
                                  validTimeCode = checkTimeCodeValid(stringToTc(promptString))
                      
                                  if (validTimeCode) {
                                      return validTimeCode
                                  };
                      
                              };
                          };
                      };
                      
                      //First, ask the user for their input and check if is valid
                      const timecode = userTimeCode()
                      
                      // Set selection
                      sf.ui.proTools.selectionSetTimecode({
                          selectionStart: timecode,
                      });
                      
                      // create memoy location
                      sf.ui.proTools.memoryLocationsCreate({name: timecode})
                      
                      // Get current timecode in samples
                      const timecodeInSamples = sf.ui.proTools.selectionGetInSamples()
                      
                      
                      // Set selection -10s and +10s, if sample rate is 48k
                      sf.ui.proTools.selectionSetInSamples({
                          selectionStart: +timecodeInSamples.selectionStart - 480000,
                          selectionEnd: +timecodeInSamples.selectionStart + 480000,
                      })
                      
                      
                      
                      // Now Bounce
                      

                      For the memory location, it is being named the timecode, but can be something else. Could have prompt for example.

                      For the bounce part, my advice, if you are using Bounce mix window is to setup a default. I actually published a template for this window in the store, but haven't made the settings for video. If you can't use default you can always use the template I made as starting point and add the video options.

                      Let me know how it goes.