No internet connection
  1. Home
  2. How to

Auto Align Post... set sidechain by script

From a chat: @Jens_Johansson
Jens - moving your chat here to the regular forum :)

Hi!
Is there any way to modify the AA Post script so I can set the sidechain input to a specific channel?
Also, if the plugin would close automatically after processing it would be nice :)
All the best // Jens

Solved in post #9, click to view
  • 9 replies
  1. Hi Jens!
    Thanks for posting this idea - that could definitely be possible.
    Can I get you to post the AA Post script that you're referring to here, then I'd be happy to augment it.

    1. J
      In reply tochrscheuer:
      Jens Johansson @Jens_Johansson
        2019-09-15 17:32:33.989Z

        Here's what I came up with after some copy/pasting from other scripts. Works for selecting the right sidechain input.
        But if I align a large number of clips at the same time the closing of AA Post window doesn't work.
        Is there a way to make the code for closing the window wait until the processing is finished?

        //Open the plugin and save the plugin window to the "asWin" variable
        var asWin = sf.ui.proTools.audioSuiteOpenPlugin({
        category: 'Other',
        name: "Auto-Align Post"
        }).window;

        //Set processing options
        asWin.audioSuiteSetOptions({
        processingInputMode: "ClipByClip",
        processingOutputMode: "CreateIndividualFiles"
        });

        // Select Sidechain Track
        var keyInputName = 'D1 Boom';
        sf.ui.proTools.appActivate();

        var asWin = sf.ui.proTools.getAudioSuiteWindow("Auto-Align Post");
        asWin.elementRaise();

        var keyInputBtn = sf.ui.proTools.firstAudioSuiteWindow.invalidate().popupButtons.whoseTitle.is('Key Input').first;
        keyInputBtn.popupMenuSelect({
        menuPath: [keyInputName]
        });

        // Render Audiosuite
        sf.ui.proTools.audioSuiteRenderCurrent();

        // Wait

        // Close Plugin Window
        asWin.windowClose();

        1. N
          In reply tochrscheuer:
          N Leyers @NickLeyers_old_acc
            2019-09-16 08:22:34.422Z

            Hi Jens

            I use this code to set the sidechain to any track my selection is on. Got a key for that. Processing i something I do with another key and script because that gives me more possibilities( in my workflow). I got a seperate screen where I keep a lot of audiosuites open for fast processing. Protools is to slow to wait for opening and closing these plugins all the time :-)

            //Get first track from selection
            var name = sf.ui.proTools.selectedTrackNames[0];

            //Focus AAP
            var asWin = sf.ui.proTools.getAudioSuiteWindow("Auto-Align Post");
            asWin.elementRaise();

            //Set Key input
            sf.ui.proTools.appActivate();
            var keyInputBtn = sf.ui.proTools.firstAudioSuiteWindow.invalidate().popupButtons.whoseTitle.is('Key Input').first;
            keyInputBtn.popupMenuSelect({
            menuPath: [name]
            });

            PS: I forgot how to put the code in a 'code box' in this forum.... Tips? :-)

            1. JJens Johansson @Jens_Johansson
                2019-09-16 19:36:41.031Z

                Thanks Nick will try that out.
                I also keep plugins open on a second screen but just the ones I look at during mix.
                AA Post is a "render and forget" type of plugin for me :) So if the window would close after
                rendering it would be awesome.

                1. NN Leyers @NickLeyers_old_acc
                    2019-09-17 05:39:04.706Z

                    Sure, got some plugins that will open and close as well.
                    For waiting I use this:

                    //Wait for window to complete
                    sf.wait({intervalMs: 500});

                    And make the 500 longer depending on how long it will take more or less.

                    But I think it's also possible (and better) to wait for the action to complete. This was a possibility but I'm not sure if it is functional?...

                    sf.ui.proTools.waitForNoModals();

                    Or you can write and if-loop who checks if there is a window that is named 'processing'. Like every 200mS. But that's a lot of code for a small action...

                    1. The wait for no modals works yes for rendering audiosuite plugins.
                      But if you get access to the window via the getAudioSuiteWindow action, then you can also make use of the audioSuiteRender action, which will take care of waiting for you.

                      So for example you can do this:

                      var asWin = sf.ui.proTools.getAudioSuiteWindow("Auto-Align Post");
                      asWin.audioSuiteRender();
                      asWin.windowClose();
                      
                      1. JJens Johansson @Jens_Johansson
                          2019-09-18 16:56:37.273Z

                          Works like a dream! Thanks Christian!

                          1. Dario Ramaglia @dario.ramaglia
                              2019-09-19 07:36:34.360Z

                              I use this script so I can choose the sidechain on the StreamDeck.
                              You can change the colors of course and I also included a "Name-Shortener" :)

                              //Focus AAP
                              
                              var asWin = sf.ui.proTools.getAudioSuiteWindow("Auto-Align Post");
                              asWin.elementRaise();
                              
                              //Select SideChain
                              var trackNames = ['Boom1', 'Boom2', 'Boom3', 'Boom4', 'Boom5', 'Radio1', 'Radio2', 'Radio3', 'Radio4', 'Radio5','Adr Sync B'];
                              
                              ///Title Shortener
                              function shortenTitle(s) {
                                  var res = '', i = 0;
                                  while (s.length > 0 && i < 3) {
                                      if (i > 0) res += '\n';
                                      res += s.substring(0, 8);
                                      s = s.substring(8);
                                      i++;
                                  }
                                  return res;
                              }
                              
                              
                              ///Assing Colors
                              
                              var selectedName = sf.devices.streamDeck.firstDevice.showModal({
                                  items: trackNames.map(function (name, i) {
                                      var color;
                                      if (name.indexOf('Boom') >= 0)
                                          color = { r: 74, g: 0, b: 106 };
                                      else if (name.indexOf('Radio') >= 0)
                                          color = { r: 22, g: 100, b: 106 };
                                      else if (name.indexOf('Adr Sync B') >= 0)
                                      color = { r: 142, g: 15, b: 8 };
                                      return {
                                          title: shortenTitle(name),
                                          value: name,
                                          color: color
                                  };
                              })
                              }).selectedItem.value;
                              
                              /// Select the Key Input
                              sf.ui.proTools.appActivate();
                              var keyInputBtn = sf.ui.proTools.firstAudioSuiteWindow.invalidate().popupButtons.whoseTitle.is('Key Input').first;
                              keyInputBtn.popupMenuSelect({
                                  menuPath: [selectedName]
                              });
                              
                              ///Analyze
                              
                              asWin.getFirstWithTitle("Analyze").elementClick();
                              
                              ///Wait till analyze done 
                              sf.ui.proTools.waitForNoModals();
                              
                              //Render
                              asWin.audioSuiteRender();
                              
                              Reply1 LikeSolution
                              1. JJens Johansson @Jens_Johansson
                                  2019-09-19 07:48:29.307Z

                                  Wow looks really nice! Thanks Dario!