No internet connection
  1. Home
  2. How to

Change Computer Audio Output device

By Tristan Dewey @Tristan_Dewey
    2024-01-16 04:54:07.315Z

    Is there a simple way to change Mac audio output device?
    Streamdeck had a great plugin that would allow you to trigger Keyboard Maestro macros (Set Audio Device).

    Solved in post #2, click to view
    • 3 replies
    1. Nathan Salefski @nathansalefski
        2024-01-17 18:38:56.026Z

        You can check here for something that does it even more efficiently in my opinion Select a setting in Mac Preferences #post-2

        Reply1 LikeSolution
        1. In reply toTristan_Dewey⬆:
          Chad Wahlbrink @Chad
            2024-02-16 16:56:53.728Z

            Hey @unnamed_1705!

            You also may find it useful to fire Keyboard Maestro commands from within SoundFlow. I'd suggest doing this by

            • IN KBM - Retrieve a url trigger to your KBM action
            • IN SF - using a macro within in SoundFlow to "Open a File"
            • IN SF - Paste the kbm url trigger into the SoundFlow "Open a File" path field.



            1. In reply toTristan_Dewey⬆:
              Loran Keuning @Loran_Keuning
                2025-02-04 07:29:25.924Z

                I think i found an Soundflow function that does this? Only thing you have to do is convert it to a template and add a template property called 'outputName' with the string type.

                // Get target name from event props with case insensitivity
                let outputName = event.props.outputName ? event.props.outputName.trim() : null;
                
                if (!outputName) {
                    throw new Error("No target device name provided");
                }
                
                const devices = sf.audio.getAudioDevices().devices;
                let deviceId = null;
                const searchName = outputName.toLowerCase(); // Normalize case for comparison
                
                // Case-insensitive search
                for (let i = 0; i < devices.length; i++) {
                    const deviceName = devices[i].deviceName ? devices[i].deviceName.trim().toLowerCase() : "";
                    if (deviceName === searchName) {
                        deviceId = devices[i].deviceId; // Note correct capitalization of DeviceId
                        outputName = devices[i].deviceName;
                        break;
                    }
                }
                
                if (deviceId) {
                    sf.audio.selectAudioDevice({ deviceId: deviceId });
                    log(`Selected Audio Device: "${outputName}"`);
                } else {
                    log(`Audio Device: "${outputName}" was not found.`);
                }