No internet connection
  1. Home
  2. How to

Transfer Soundminer playback volume to clip gain value of spotted to PT clip (in dBs)

By Stepan Sevastyanov @Stepan_Sevastyanov
    2019-06-16 06:08:01.557Z

    Hello Soundflow users,
    I think, this one would not be easy to implement but it would be very cool if this kind of dream would become a reality! It would save a lot of time for FX/AMB editing. When transferring clips from Soundminer to Pro Tools via “Spot to” command (S shortcut) I would like to transfer value of volume playback fader in Soundminer to clip gain of just transferred clip.
    So, 1) I adjust the volume when playing back file in SM 2) I press the S key and SM transfers clip to PT 3) Soundflow script adjusts the clip gain of this new clip in PT by the same dB at which was set the Soundminer playback volume fader.

    Is it even possible? Would make life for editors so much easier (no need to lowering clip gain of normalized to 0 dBFS audio after each transfer anymore)! Thanks a lot!

    • 7 replies
    1. Great idea! We actually have some code to do parts of this so would definitely be interesting to see if we can glue it together to make this work :)

      1. Great news! :)

        1. In reply tochrscheuer:
          TTom van Heesch @Tom_van_Heesch
            2019-06-21 21:37:41.667Z

            Exciting! Hope it works!

          • G
            Gray Aletter @Gray_Aletter
              2024-03-14 08:49:37.140Z

              Any luck with this one? :)

              1. OOwen Granich-Young @Owen_Granich_Young
                  2024-03-14 17:06:53.424Z2024-03-14 17:36:40.395Z

                  I got part way there then abandoned cuz work picked up... if anybody wants to pickup where I left off... If I recall correctly your track has to be set in Touch or Latch and probably has to be Small or Med size at least, not a lot of guard rails in the script currently.

                  this one is labeled working version?

                  const pT = sf.ui.proTools
                  const sM = sf.ui.app("com.soundminer.v6")
                  
                  sM.appActivate();
                  
                  const logVolume = sM.mainWindow.groups.whoseDescription.is("Main Group").first.sliders.whoseTitle.is("Audition Volume").first.value.value
                  const faderValue = 20 * Math.log(Number(logVolume))
                  const roundedFaderValue = Math.round(faderValue * 10.0) / 10
                  
                  
                  pT.appActivate();
                  pT.mainWindow.invalidate();
                  
                  sf.ui.proTools.automationPreview()
                  
                  if(!pT.mainTrackOutputWindow.groups.first.exists){
                  pT.selectedTrack.trackOutputToggleShow();
                  pT.mainTrackOutputWindow.elementWaitFor()
                  }else{
                      pT.mainTrackOutputWindow.elementRaise();
                  }
                  
                  pT.mainTrackOutputWindow.textFields.whoseTitle.is("Volume Numerical").first.elementClick();
                  sf.keyboard.type({ text: String(roundedFaderValue) });
                  sf.keyboard.press({ keys: "numpad enter", });
                  
                  sf.ui.proTools.automationWriteAutoToSelectionAndClear({
                      autoConfirmation: true,
                  });
                  
                  sf.ui.proTools.menuClick({
                      menuPath: ["Edit","Automation","Coalesce Volume Automation to Clip Gain"],
                  });
                  
                  

                  And this one is refactored to be more clear (maybe it's working, better one to work off I imagine.). I bet a heavy can swing in here and fix this up. @chrscheuer is probably the most Sound Miner Fluent of the developers team. I know @kitch has it but it's not exactly his bag. @Dustin_Harris might also be able to bring this puppy home.

                  const pT = sf.ui.proTools
                  const sM = sf.ui.app("com.soundminer.v6")
                  
                  /// Select Next Clip
                  const cntrlTab = () => sf.keyboard.press({ keys: "ctrl+tab", fast: true, });
                  
                  ///Log Vol Slider in SM and Set Clipgain Relative
                  function setGain() {
                      sM.appActivate();
                      sM.invalidate();
                  
                      const logVolume = sM.mainWindow.groups.whoseDescription.is("Main Group").first.sliders.whoseTitle.is("Audition Volume").first.value.value
                      const faderValue = 20 * Math.log(Number(logVolume))
                      const roundedFaderValue = Math.round(faderValue * 10.0) / 10
                      pT.appActivate();
                      pT.invalidate();
                      sf.ui.proTools.automationPreview()
                  
                      if (!pT.mainTrackOutputWindow.groups.first.exists) {
                          pT.selectedTrack.trackOutputToggleShow();
                          pT.mainTrackOutputWindow.elementWaitFor()
                      } else {
                          pT.mainTrackOutputWindow.elementRaise();
                          sf.wait({ intervalMs: 50 })
                      }
                  
                  
                      pT.mainTrackOutputWindow.textFields.whoseTitle.is("Volume Numerical").first.elementClick();
                      sf.keyboard.type({ text: String(roundedFaderValue) });
                      sf.keyboard.press({ keys: "numpad enter", });
                  
                      sf.ui.proTools.automationWriteAutoToSelectionAndClear({
                          autoConfirmation: true,
                      });
                  
                      sf.ui.proTools.menuClick({
                          menuPath: ["Edit", "Automation", "Convert Volume Automation to Clip Gain"],
                      });
                  }
                  
                  ///Spot to Daw
                  function spotToDaw() {
                      const sM = sf.ui.app("com.soundminer.v6");
                      const mainWin = sM.windows.whoseTitle.startsWith('Soundminer Pro - ').first;
                  
                      //Invalidate main window
                      sM.mainWindow.invalidate();
                  
                      sM.appActivateMainWindow();
                  
                      mainWin.elementRaise();
                  
                      const toolbar = sM.mainWindow.groups.first;
                      const spotToDawButton = toolbar.buttons.whoseTitle.is("Spot to DAW").first;
                  
                      spotToDawButton.elementClick();
                      sf.wait({ intervalMs: 10 });
                  }
                  
                  
                  function main() {
                      spotToDaw();
                  
                      let trys = 100
                  
                      while (sf.ui.frontmostApp.activeBundleID !== "com.avid.ProTools" || trys <= 0) {
                          sf.wait({ intervalMs: 100 });
                  
                          trys--
                      }
                  
                      if(trys <= 0) throw `Failed waiting for Pro Tools`;
                  
                      cntrlTab();
                  
                      setGain();
                  }
                  
                  
                  //Return to current App
                  
                  function setupRestore() {
                      const frontmostApp = sf.ui.frontmostApp;
                  
                      try {
                  
                          main();
                  
                      } catch (err) {
                          throw err;
                      } finally {
                  
                          frontmostApp.appActivateMainWindow();
                  
                      }
                  }
                  
                  setupRestore();
                  
                  
                  1. Dustin Harris @Dustin_Harris
                      2024-03-14 18:28:21.048Z

                      This is my super quick and dirty version @Gray_Aletter , this assumes there is no timeline selection in pro tools (just an insertion point) and that clip gain nudge value is set to 1.0dB :)

                      function main() {
                      
                          const slider = sf.ui.soundminer.mainWindow
                              .groups.whoseDescription.is("Main Group").first
                              .sliders.whoseTitle.is("Audition Volume").first;
                          //end slider
                      
                          const logVolume = slider.value.invalidate().value;
                          const faderValue = 20 * Math.log(Number(logVolume))
                          const absoluteClipGain = Math.abs(Math.round(faderValue))
                      
                          const result = sf.ui.soundminer.soundminerSpotToDaw();
                          
                          //wait until spot to pro tools is finished
                          while (!result) sf.wait({ intervalMs: 100 });
                      
                          sf.ui.proTools.appActivateMainWindow();
                      
                          sf.wait({intervalMs: 100})
                      
                          //select whole clip
                          sf.keyboard.press({
                              keys: "shift+tab"
                          })
                      
                          //update pro tools UI
                          sf.app.proTools.hasOpenSession
                      
                          sf.wait({intervalMs: 100})
                      
                          //set clip gain
                          sf.keyboard.press({
                              keys: "ctrl+shift+down",
                              repetitions: absoluteClipGain,
                              fast: true
                          });
                      
                          //update pro tools UI
                          sf.app.proTools.hasOpenSession
                      }
                      
                      main();
                      
                      1. Slick. Sure would be nice if ProTools would allow/create a SDK for setting clip gain values instead of having to increment them.