No internet connection
  1. Home
  2. How to

Terminate SoundFlow after executing python script

By Udi Simhon @Udi_Simhon
    2024-04-24 09:56:13.418Z

    Hi, I'm using the following script to execute a Python script. The problem is that SoundFlow is not terminating, and the icon remains blue.

    function runPythonScript({ scriptPath, option1, option2, inputPath, outputPath }) {
        const result = sf.system.exec({ commandLine: `python3 "${scriptPath}" -option_1 ${option1} -option_2 ${option2} '${inputPath}' '${outputPath}'` });
        while (!result) sf.wait({ intervalMs: 50 });
        if (result.exitCode > 0) throw `Error Processing Python Script\nExit Code: ${result.exitCode}\nStandardError:\n${result.standardError}`;
    }
    
    const myPythonScript = "/Volumes/Artlist Audio All/Artlist NAS 23/POST MASTERING STEMS/SCRIPTS/__PANELS__/NAS Basic Compact.py";
    const speed = 2.5;
    const pitch = 1.1;
    const fileToProcess = "~/Desktop/someWaveFile.wav";
    const processedFile = "~/Desktop/someWaveFile_Processed.wav";
    
    runPythonScript({
        scriptPath: myPythonScript,
        option1: speed,
        option2: pitch,
        inputPath: fileToProcess,
        outputPath: processedFile,
    });
    
    • 1 replies
    1. Dustin Harris @Dustin_Harris
        2024-04-24 16:42:23.772Z

        It’s possible your python script is taking a while to execute, which the SoundFlow script is waiting for in line 3 (it is waiting for the results of running the python script). If you just want to trigger the python script and let it run asynchronously, I think removing lines 3 and 4 should do it.