No internet connection
  1. Home
  2. How to

How To Choose a System Sound Output Path?

By Philip weinrobe @Philip_weinrobe
    2024-10-29 14:44:58.452Z

    Hello Geniuses
    I have this great little line of code that says "your bounce is finished sir" when my bounce script finishes running.
    Problem is, the audio comes out of whatever i have my system audio set to, which is always different than my monitors which are coming off my avid carbon.

    I am wondering if there is a way to use soundflow to route a specific audio command to a specific sound output.
    In this case i want to use "Studio Display Speakers"

    Thank you!

    sf.system.exec({
        commandLine: `say "Your bounce is finished sir."`
    });
    
    • 3 replies
    1. Chad Wahlbrink @Chad2024-10-29 16:05:18.121Z

      Hey @Philip_weinrobe,

      At the end of this post, I go over a few ways to set the sound output on a Mac. These may help you out.

      You can get device IDs for your audio devices with this short script:

      log(sf.audio.getAudioDevices().devices)
      

      The device IDs will show up in the log. You can access the full log here:

      The output will look something like this:

      [
      {
              "DeviceId": 126,
              "DeviceName": "Universal Audio Thunderbolt",
              "IsActiveInput": false,
              "IsActiveOutput": false
          }
      ]
      

      Then, you can set an audio device by the device ID with another short script like this:

      sf.audio.selectAudioDevice({deviceId:126})
      
      1. Chad Wahlbrink @Chad2024-10-29 16:12:44.864Z

        I think you should be able to switch to the studio display speakers like this:

        
        // Define the active audio device
        let activeAudioDevice = sf.audio.getAudioDevices().devices.filter(x => x.isActiveOutput)[0]
        let studioDisplayDevice = sf.audio.getAudioDevices().devices.filter(x => x.deviceName == 'Studio Display Speakers')[0]
        
        // Set output to Studio display
        sf.audio.selectAudioDevice({deviceId:studioDisplayDevice.deviceId})
        
        // Say "Your Bounce is Finished Sir"
        sf.system.exec({
            commandLine: `say "Your bounce is finished sir."`
        });
        
        // Activate the last active Audio Device
        sf.audio.selectAudioDevice({deviceId:activeAudioDevice.deviceId})
        
        1. PPhilip weinrobe @Philip_weinrobe
            2024-10-29 19:28:11.134Z

            absolutely incredible.
            beautiful instructions
            works PERFECT