No internet connection
  1. Home
  2. How to

Selecting Input for selected MIDI track in Pro Tools

By Alex E @Alex_E
    2024-04-18 13:16:44.571Z

    Hi all,

    I would like to be able to select specific MIDI inputs for MIDI tracks via stream deck buttons.

    The soundflow inbuilt action "Select Input Routing" does what I want but doesn't seem to work for MIDI tracks. Any help or advice on how to modify this to work with MIDI tracks would be much appreciated. Thank you

    Solved in post #2, click to view
    • 4 replies
    1. Chris Shaw @Chris_Shaw2024-04-18 19:05:43.359Z2024-04-18 20:30:00.752Z

      This script should do it.
      Just change the midiInputPath for your desired MIDI Input:

      const midiInputPath = ["Predefined", "SoundFlow Custom Midi Output 1", "channel-1"];
      
      /**
       * @param {String[]} midiInputMenuPath
       */
      function setMidiTrackInput(midiInputMenuPath) {
          const tracks = sf.app.proTools.tracks.invalidate().allItems;
      
          const firstSelectedTrack = tracks.filter(track => track.isSelected)[0];
      
          //Check if selected track is a MIDI track
          if (firstSelectedTrack.type !== "Midi") {
              sf.interaction.notify({ title: "Selected track is not a MIDI track" });
              throw 0
          };
      
          //Ensure track I/O is visible
          sf.ui.proTools.menuClick({
              menuPath: ["View", "Edit Window Views", "I/O"],
              targetValue: "Enable"
          })
      
          //Ensure track is visible in Edit window
          sf.ui.proTools.trackGetByName({ name: firstSelectedTrack.name }).track.trackScrollToView()
      
          // Define MIDI input popup menu button
          const midiIo = sf.ui.proTools.selectedTrack.groups.whoseTitle.is("MIDI IO").first;
          const midiInputBtn = midiIo.buttons.whoseTitle.startsWith("MIDI Input selector").first;
      
          // Select MIDI input
          midiInputBtn.popupMenuSelect({
              menuPath: midiInputPath
          })
      }
      
      setMidiTrackInput(midiInputPath)
      
      ReplySolution
      1. This script will throw an error if the track I/O column isn't visible.

        1. Never mind, I added some code to ensure the I/O is visible

          1. AAlex E @Alex_E
              2024-04-22 07:57:11.063Z

              Thanks so much Chris! Works great