No internet connection
  1. Home
  2. How to

Session prep script

By JP Ruggieri @JP_Ruggieri
    2021-09-17 17:15:59.901Z

    Hey everyone, I'm brand new to sound flow so I'm sorry if this has been answered, I couldn't find it on the forum. I'm looking to have a script that can help me with prepping. Pretty much I want to be able to highlight all of the drum tracks (for example) when I start a session, then hit a button on my ipad that is green and says "drums" on it. Then I want sound flow to color all of those tracks green, route them to "drum bus" and make the input "no input" and put my SSL channel strip plugin on the first insert slot. Is there a script written for something like this? Thank you!

    • 13 replies

    There are 13 replies. Estimated reading time: 11 minutes

    1. O

      Check out SCHEPS color deck in the store for the first part. (Or basic Color track Macro)

      Search forum just for Routing Selected tracks to new AUX (a number of sweet different options people have built)

      Teezo's Plugin Loader by Kitch Membery or Chris Shaws (insert pluging on next free slot) in store for the third request

      You should be able to combine those tools in the macro building seciton (no programming needed) to build a macro of your own design.

      And as a bonus I reccomend seaching SSL in the forum as somebody requested a script that always shows the SSL EQ of their selected track, which is pretty sweet.

      Happy Flowing

      1. J
        In reply toJP_Ruggieri:
        JP Ruggieri @JP_Ruggieri
          2021-09-18 01:13:46.091Z

          Hey thanks for this! Everything is working perfect except for teezos plugin loader is only loading the plugin for the first track that is selected. so for example if I have 5 tracks selected, the script is working for all of the tracks to color and route them and group them but when it gets to the last step of putting the ssl channel strip on eaach track it only does it to the first track. any idea why this would happen? Thanks!

          1. Kitch Membery @Kitch2021-09-18 02:00:21.587Z

            Hi @JP_Ruggieri,

            I just happened upon this post, and thought I’d chime in. 😀

            Teezio’s Plug-in Loader was designed for instantiating plugins on single tracks. I plan on eventually having it work on multiple tracks but it will take some time to program it due to amount of track width/plug-in types. I'll see if I have some time over the weekend to create a script to do what you are after.

            Rock on!

            1. In reply toJP_Ruggieri:
              Kitch Membery @Kitch2021-09-18 02:10:45.113Z

              Actually, I was over thinking it.

              If the tracks are of the same width, the following script should do the trick :-)

              const pluginPath = ["plug-in", "Waves Audio", "SSLChannel (mono)"];
              const insertSlotNumber = 1;
              
              function addInsert(pluginPath, insertSlotNumber) {
                  sf.ui.proTools.selectedTrack.insertSelectorButtons[insertSlotNumber].popupMenuSelect({
                      isShift: true,
                      isOption: true,
                      menuPath: pluginPath,
                  });
              }
              
              addInsert(pluginPath, insertSlotNumber);
              

              Just change the plugin path to match the SSL Chanel strip you are using.

              I hope that helps. :-)

            2. J
              In reply toJP_Ruggieri:
              JP Ruggieri @JP_Ruggieri
                2021-09-18 02:31:00.597Z

                Thanks for this Kitch. Unfortunately it doesn't seem to be working. I put some screen shots so you can see my script. Also, when you say the same width do you mean stereo and mono tracks? I would like it to be able to open the plugin for both mono and stereo tracks at the same time if possible?

                1. Kitch Membery @Kitch2021-09-18 02:46:53.744Z

                  Ahh... Make sure you check the whole path for the plug-in. Note: the first part of the path changes depending on the width of the tracks. if it's mono it will be named "plug-in" and for stereo it will be "multichannel plug-in". I can see you have "plug-in" as the first part of your path.

                  If I get time this weekend I'll whip up a script to insert both mono and stereo. :-)

                  Rock on!

                  1. JJP Ruggieri @JP_Ruggieri
                      2021-09-18 04:15:32.653Z

                      Oh man, that would be awesome. If you end up writing it do let me know! Thanks again for the help, the script is working now

                      1. In reply toKitch:
                        JJP Ruggieri @JP_Ruggieri
                          2021-09-25 21:00:47.620Z

                          Hey Kitch, by any chance did you have some time to write a script that would work with both stereo and mono tracks? I'd love to have the stereo tracks open up the plugin in multi mono. Thanks so much!

                          1. Kitch Membery @Kitch2021-09-25 21:17:23.902Z

                            Hi @JP_Ruggieri,

                            I have not forgotten about this. Have had a bit on my plate this week, will keep you posted. :-)

                            1. JJP Ruggieri @JP_Ruggieri
                                2021-09-25 21:50:18.106Z

                                No problem, thanks so much!!

                                1. Kitch Membery @Kitch2021-09-26 04:45:26.822Z

                                  Hi @JP_Ruggieri,

                                  This should do the trick.

                                  Note: the script will only work on Mono and Stereo Tracks (and is not setup to work on master tracks). I intend to add this kind of functionality to the Plugin Loader at some stage. But may take a while. :-)

                                  /** 
                                   * @param {AxPtTrackHeader} track 
                                   * @return {number} width 
                                   */
                                  function getTrackWidth(track) {
                                      var width = track.groups.whoseTitle.is('Audio IO').first.sliders.whoseTitle.contains('Pan').count;
                                      return width;
                                  }
                                  
                                  /** 
                                   * @param {string[]} pluginPath
                                   * @param {number} pluginSlotNumber
                                   */
                                  function loadInsert(pluginPath, pluginSlotNumber) {
                                      sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({
                                          pluginNumber: pluginSlotNumber,
                                          pluginPath,
                                          selectForAllSelectedTracks: true,
                                      });
                                  }
                                  
                                  /** @param {string} trackName */
                                  function scrollToTrack(trackName) {
                                      sf.ui.proTools.appActivateMainWindow();
                                  
                                      var originalClipboardText = sf.clipboard.getText().text || '';
                                  
                                      sf.ui.proTools.menuClick({ menuPath: ["Track", "Scroll to Track..."] });
                                  
                                      sf.ui.proTools.confirmationDialog.elementWaitFor();
                                  
                                      sf.clipboard.setText({ text: trackName });
                                  
                                      sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Paste'] });
                                  
                                      sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is("OK").first.elementClick();
                                  
                                      sf.clipboard.setText({ text: originalClipboardText, });
                                  }
                                  
                                  /**
                                   * @param {object} obj
                                   * @param {string[]} obj.monoTrackInsertPath
                                   * @param {string[]} obj.stereoTrackInsertPath
                                   * @param {number} obj.pluginSlotNumber
                                   */
                                  function addInsertToSelectedTracks({ monoTrackInsertPath, stereoTrackInsertPath, pluginSlotNumber }) {
                                      sf.ui.proTools.appActivateMainWindow()
                                      sf.ui.proTools.mainWindow.invalidate();
                                  
                                      const originalTrackNames = sf.ui.proTools.selectedTrackNames;
                                  
                                      sf.ui.proTools.menuClick({ menuPath: ['View', 'Edit Window Views', 'Inserts A-E'], targetValue: "Enable" });
                                      sf.ui.proTools.menuClick({ menuPath: ['View', 'Edit Window Views', 'Inserts F-J'], targetValue: "Enable" });
                                      sf.ui.proTools.menuClick({ menuPath: ['View', 'Edit Window Views', 'I/O'], targetValue: "Enable" });
                                      sf.ui.proTools.menuClick({ menuPath: ['Window', 'Edit'], targetValue: "Enable" });
                                  
                                      const selectedTrackHeaders = sf.ui.proTools.selectedTrackHeaders;
                                  
                                      const trackInfo = selectedTrackHeaders.map(track => ({
                                          trackTitle: track.normalizedTrackName,
                                          trackType: track.title.invalidate().value.split(' - ')[1].trim(),
                                          trackWidth: getTrackWidth(track),
                                      }));
                                  
                                      // @ts-ignore
                                      const trackWidths = [...new Set(trackInfo.map(t => t.trackWidth))];
                                  
                                      trackWidths.forEach(trackWidth => {
                                  
                                          if (trackWidth > 0 && trackWidth <= 2) {
                                              let trackNames = trackInfo
                                                  .filter(track => track.trackWidth === trackWidth)
                                                  .map(track => track.trackTitle);
                                  
                                              let selectedTrackName = sf.ui.proTools.selectedTrack.normalizedTrackName;
                                  
                                              scrollToTrack(selectedTrackName);
                                  
                                              sf.ui.proTools.trackSelectByName({ names: trackNames });
                                  
                                              switch (trackWidth) {
                                                  case 1:
                                                      loadInsert(monoTrackInsertPath, pluginSlotNumber);
                                                      break
                                                  case 2:
                                                      loadInsert(stereoTrackInsertPath, pluginSlotNumber);
                                                      break
                                              }
                                          }
                                      });
                                  
                                      scrollToTrack(originalTrackNames[0]);
                                  
                                      sf.ui.proTools.trackSelectByName({ names: originalTrackNames });
                                  }
                                  
                                  addInsertToSelectedTracks({
                                      pluginSlotNumber: 1,
                                      monoTrackInsertPath: ["plug-in", "Waves Audio", "SSLChannel (mono)"],
                                      stereoTrackInsertPath: ["multi-mono plug-in", "Waves Audio", "SSLChannel (mono)"],
                                  });
                                  

                                  You'll need to edit the function call at the end of the script with your desired Plugin Slot Number and Mono & Stereo Insert Paths.

                                  addInsertToSelectedTracks({
                                      pluginSlotNumber: 1,
                                      monoTrackInsertPath: ["plug-in", "Waves Audio", "SSLChannel (mono)"],
                                      stereoTrackInsertPath: ["multi-mono plug-in", "Waves Audio", "SSLChannel (mono)"],
                                  });
                                  

                                  Let me know how it runs for you. :-)
                                  Rock on!

                                  1. JJP Ruggieri @JP_Ruggieri
                                      2021-09-27 01:38:54.784Z

                                      This is so so great thank you! Works perfectly, you're the best thank you!!

                                      1. Kitch Membery @Kitch2021-09-27 02:57:14.735Z

                                        You're welcome @JP_Ruggieri

                                        Have a great week :-)
                                        Rock on!