[Python] Launching audacity from Python and loading multiple audios

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to write a python script which loads Audacity with multiple audio files in the same window. So far I have been able to do this but instead of opening both audio files on the same window, 2 independent Audacity windows are opened , one for each audio file.

    Is there a way to get both audios to load on the same Audacity window?

    Bonus question in case you know the answer:

    Is there a way to close Audacity properly from my Python script? Every time I stop Python script execution and reuse Audacity, it says that my previous projects crashed but I don't see a way to properly close (e.g. say I don't want to save) the Audacity projects from my Python script

    See my Python code below

    import subprocess

    # Opening files in A and B files in Audacity
    original_mic_file = "A.wav"
    cleaned_mic_file = "B.wav"

    if os.name == 'nt': # Windows
    audacity_path = "C:\\Program Files\\Audacity\\audacity.exe"
    subprocess.Popen([audacity_path, original_mic_file,cleaned_mic_file])


    Edit: To those downvoting, please comment why

    Continue reading...

Compartilhe esta Página