No internet connection
  1. Home
  2. How to

I want to make "mono to stereo"

By Yujiro Yonetsu @Yujiro_Yonetsu
    2021-12-24 15:33:09.943Z

    Hello Gurus.

    I want to make "mono to stereo" script.

    It turns two mono tracks into a single stereo track.

    It looks like this image.

    For that I created a script.

    
    //store selection target track
    var originallySelectedTrackNames = sf.ui.proTools.selectedTrackNames.slice();
    
    //copy target clip
    sf.ui.proTools.menuClick({
        menuPath: ["Edit","Select All"],
    });
    
    sf.ui.proTools.menuClick({
        menuPath: ["Edit","Copy"],
    });
    
    //make new stereo track
    sf.ui.proTools.menuClick({
        menuPath: ["Track","New..."],
    });
    
    sf.ui.proTools.windows.whoseTitle.is("New Tracks").first.elementWaitFor();
    
    sf.ui.proTools.windows.whoseTitle.is("New Tracks").first.popupButtons.whoseDescription.is("Track format").first.popupMenuSelect({
        menuPath: ["Stereo"],
    });
    
    sf.ui.proTools.windows.whoseTitle.is("New Tracks").first.popupButtons.whoseDescription.is("Track type").first.popupMenuSelect({
        menuPath: ["Audio Track"],
    });
    
    sf.ui.proTools.windows.whoseTitle.is("New Tracks").first.textFields.whoseTitle.is("Track Name").first.elementSetTextFieldWithAreaValue({
        value: "stereo",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("New Tracks").first.buttons.whoseTitle.is("Create").first.elementClick();
    
    sf.ui.proTools.windows.whoseTitle.is("New Tracks").first.elementWaitFor({
        waitType: "Disappear",
    });
    
    sf.ui.proTools.invalidate().trackSelectByName({ names: originallySelectedTrackNames });
    
    
    sf.keyboard.press({
        keys: "semicolon",
    });
    
    
    
    //paste clip
    sf.ui.proTools.menuClick({
        menuPath: ["Edit","Paste"],
    });
    
    
    //Hide original track
    sf.ui.proTools.invalidate().trackSelectByName({ names: originallySelectedTrackNames });
    
    sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({
        menuPath: ['Hide and Make Inactive'],
        isRightClick: true,
    });
    
    

    However, in my inexperience, I could only name the finished track "stereo".
    The rule making I want to do is
    1.Extract the common string from the track names of the two selected tracks.
    (If this is all you have, for example, "pf.L" and "pf.R" it will end up with "pf.")
    2.So, Erase the last letter. Or erase the last character if it is a symbol.

    Please let me know how to do this.

    Thank you.

    Yujiro

    • 7 replies
    1. @Yujiro_Yonetsu,

      My "Track Data Utilities" package in the store has a script that does this.

      1. Yujiro Yonetsu @Yujiro_Yonetsu
          2021-12-24 21:37:54.702Z

          Wow!
          I didn't know that, but I just tried it.

          Indeed, the naming of your script is ideal for me.
          However, the other actions seem to be too polite for me. I would really like to use only the naming part.

          Also, this script did not work well in my environment.
          I'll upload a video in case you want to see it.
          Please check.

          Thank you

          Yujiro

          1. In reply toChris_Shaw:
            GGary Keane @Gary_Keane
              2024-06-28 10:12:38.118Z

              Doesn't work for me unfortunately. It gets to the point of making the new stereo track and fails after that :(

              1. Chris Shaw @Chris_Shaw2024-06-28 15:57:17.101Z2024-06-28 16:33:16.572Z

                Hey @Gary_Keane,
                Are you running the latest version in the store (2.0.72)?
                If you are and have a moment, run that script again and after it fails run the "__Collect User Logs" script in the TDU package. This will place a Zip file on your desktop. Post that on your file sharing service of choice (DropBox etc) and post the link here. This will allow me to see what the issue is along with your setup info (MacOS, SF version etc)
                Thanks!

                1. GGary Keane @Gary_Keane
                    2024-06-28 16:42:56.118Z

                    Ah, I was running an old version! Just updated and working perfectly, thanks Chris!

                    1. Great!
                      Thanks for letting me know

              2. In reply toYujiro_Yonetsu:
                Yujiro Yonetsu @Yujiro_Yonetsu
                  2021-12-29 08:44:05.135Z

                  Hello.

                  After, I tried my best to make it in my own way.

                  This is the part of the definition of a new name.

                  var trackone = sf.ui.proTools.selectedTrackNames.slice(0, 1);
                  
                  var tracktwo = sf.ui.proTools.selectedTrackNames.slice(1, 2);
                  
                  var trone = trackone + ""
                  
                  var trtwo = tracktwo + ""
                  
                  if (true == trone.endsWith(".L")) {
                      var newname = trone.split("").slice(0, -2).join("") + " st";
                  } else if (true == trone.endsWith("_L")) {
                      var newname = trone.split("").slice(0, -2).join("") + " st";
                  } else {
                      var newname = trone + " st";
                  }
                  

                  This seems to be fine for use for now. However, I feel it is not very beautiful.
                  If possible, I would like to extract only the strings that exist between the two tracks.
                  Please tell me how to do it.

                  Thank you