No internet connection
  1. Home
  2. How to

How to automate Audio Suite plugins?

This script shows how to fully automate Audio Suite plugins - opening, setting options, selecting presets, rendering, and closing windows again.

Solved in post #2, click to view
  • 21 replies

There are 21 replies. Estimated reading time: 9 minutes

  1. //Open the plugin and save the plugin window to the "asWin" variable
    var asWin = sf.ui.proTools.audioSuiteOpenPlugin({
        category: 'Reverb',
        name: "Altiverb 7 (Stereo)"
    }).window;
    
    //Set processing options
    asWin.audioSuiteSetOptions({
        processingInputMode: "EntireSelection",
        processingOutputMode: "CreateContinuousFile"
    });
    
    //Select your preset
    asWin.audioSuiteSelectPreset({
        presetMenuPath: ["CMS Notre Dame"]
    });
    
    //Render
    asWin.audioSuiteRender();
    
    //Close the window
    asWin.windowClose();
    
    Reply1 LikeSolution
    1. If you just need to open an audio-suite plugin, use this code:

      sf.ui.proTools.audioSuiteOpenPlugin({
          category: 'Reverb',
          name: "Altiverb 7 (Stereo)"
      });
      
      1. SStefan Holm @Stefan_Holm
          2019-10-11 07:04:00.856Z

          but I get this every time I run the command.

          1. Hi @Stefan_Holm.
            Most likely the path provided to the preset you want to select is wrong. Can you show us a screenshot of the preset you're trying to select together with your specific code?
            In the code above it tries to load my preset "CMS Notre Dame" which is located in the root of my settings popup. If your preset is called something else, you should rename the preset in the script accordingly - and if you don't want to load a particular preset at all, you can delete those lines that deal with the preset selection.

            1. SStefan Holm @Stefan_Holm
                2019-10-11 12:18:35.581Z

                yes it all makes sense, but I do have the Notre Dame preset and I have pasted the code above into the script manager. Now I have tried with another preset but still the same.

                1. SStefan Holm @Stefan_Holm
                    2019-10-11 12:19:42.613Z
                    1. @Stefan_Holm can you show me a screenshot of your preset menu folded out?

                      1. SStefan Holm @Stefan_Holm
                          2019-10-11 13:12:47.766Z

                          everything works now . . just needed to create the preset my self. already made a lot of my own of this category and it works like a charm.
                          Thanks

                          1. Awesome :)

                            1. Mike Wax @mikewax
                                2022-05-26 20:02:44.239Z

                                I'm getting a similar issue where it seems as though it's not finding my preset. I have my present saved in the root folder. Here's my error:

                                1. Hi Mike

                                  It's better to use bit.ly/sfscripthelp for getting help rather than reviving this old thread :)

              • J
                In reply tochrscheuer:
                Jonathan Grossman @Jonathan_Grossman
                  2020-04-30 19:17:37.003Z

                  I am using a piece of this script for NUGEN LM CORRECT2. It fails to close the window, I believe bc of the time it's taking to render the file. I have tried using the MACRO version with the WAIT function, even up tp 4000ms, but still doens't work.

                  Here's my code:

                  sf.ui.proTools.windows.whoseTitle.is('Audio Suite: NUGEN LMCorrect2').first.buttons.whoseTitle.is('Render').first.elementClick();

                  //Close the window
                  asWin.windowClose();

                  1. Christian Scheuer @chrscheuer2020-04-30 20:04:06.566Z2020-04-30 21:07:08.702Z

                    Hi Jonathan - use asWin.audioSuiteRender(); - it should take care of waiting correctly.

                    1. Great - where do I put it in the code?

                      1. Is this the best way?

                        var asWin = sf.ui.proTools.audioSuiteOpenPlugin({
                        category: 'Sound Field',
                        name: "NUGEN LMCorrect2"
                        }).window;

                        asWin.audioSuiteRender();

                        asWin.windowClose();

                        1. Yes :)

                          1. JJonathan Grossman @Jonathan_Grossman
                              2020-05-06 16:28:59.109Z2020-05-07 14:00:09.243Z

                              This is ALMOST perfect. But let's say i already have the AS window open and need to analyze for a different preset. I click the macro, it knows the window is already open, GREAT, but it switches to back to the default preset. Can I have it ignore preset assignment if the window is already open?

                              sf.ui.proTools.audioSuiteOpenPlugin({
                                  category: "Sound Field",
                                  name: "NUGEN LMCorrect2",
                              });
                              
                              sf.ui.proTools.firstAudioSuiteWindow.audioSuiteSetOptions({
                               
                              });
                              var asWin = sf.ui.proTools.getAudioSuiteWindow("NUGEN LMCorrect2");
                              if (!asWin.exists) {
                                  asWin = sf.ui.proTools.audioSuiteOpenPlugin({
                                      category: "Sound Field",
                                      name: "NUGEN LMCorrect2",
                                  }).window;
                              }
                              //Click learn button
                              asWin.getFirstWithTitleContaining("Analyze").elementClick()
                              
                              1. I'm not 100% sure I follow - are you saying clicking Analyze/Learn makes it change preset? Or do you have other code that sets the preset that is not quoted here?
                                Or maybe it just resets the preset because you unconditionally open the plugin in your first call. If this latter guess is correct, then this should work:

                                var asWin = sf.ui.proTools.getAudioSuiteWindow("NUGEN LMCorrect2");
                                if (!asWin.exists) {
                                    //AudioSuite window isn't open, so open it and do some other stuff
                                    asWin = sf.ui.proTools.audioSuiteOpenPlugin({
                                        category: "Sound Field",
                                        name: "NUGEN LMCorrect2",
                                    }).window;
                                
                                    //Set options
                                    sf.ui.proTools.firstAudioSuiteWindow.audioSuiteSetOptions({});
                                }
                                
                                //Click learn button
                                asWin.getFirstWithTitleContaining("Analyze").elementClick();
                                
                                
                                1. I have one button for analyze that opens the window and analyzes the file. It also happens to automatically choose the user default preset.

                                  I’d rather it just leave the current preset setting if the window is already open.

                                  Ideally macro would also be smart enough to know that if I had already analyzed the file and hit the button again, it would render. Save me a button on the SD!

                                  1. I'm not sure if we can safely read if Nugen has analyzed the file or not, currently. But we'll get some more image recognition tools in 3.8 or 3.9, so that might help.

                                    Do you still need help with the script though? Nowhere in your code is there a call to set the preset, so either my assumption above was correct that your unconditional call to open the plugin effectively did choose the user default preset - or there's some part of your code we're not seeing.

                                    1. Yes it is defaulting to the user preset upon opening. You’re correct. I’ll try the code you provided. Thanks as always Christian. You and the team are amazingly generous with your time and incredible coders to boot! One of the reasons I wanted to pay for additional help is bc I felt it was appropriate to reciprocate in some way for all the support you provide.