automatically create/generate new aup file (with concrete settings)

Hallo,
I thank you for many information on this forum (mainly from Steve). I could not find info about my case, let me write my question…
I create worflow for create new project in Python.

  1. Donwload concrete mp3 files from Sharefile server - ok, i have
  2. Create folders with right name - ok, i have
  3. and now I want generate aup file where
    2 tracks will be added automatically (from mp3)
    settings label for new tracks

Does exist some possible, how do it?

Ivo

Since Audacity 3.0, Audacity projects are “AUP3” files (not “AUP”).


If you enable “mod-script-pipe”, you can send commands from Python to Audacity using named pipes, See: Scripting - Audacity Manual

Available commands are listed here: Scripting Reference - Audacity Manual
You will probably need the “Import2:” command.


Probably the easiest way to get started with scripting, is to use the Python “pipeclient” module: https://github.com/audacity/audacity/blob/master/scripts/piped-work/pipeclient.py

Ooo Mr. Steve - BIG thank you!
Maybe you are not human, but AI, or? - very quick and detail answer in the World where nobody has time for anybody…
Big help for us…
Thank you again
Ivo

Excuse me … propably detail
Python 3.9.5 (Windows 11)
I add pipeclient.py to root of my project

import pipeclient
client = pipeclient.PipeClient()
client.write("Import2: Filename='C:/Dropbox/Python/Audio_prepare_new_project/pre_000_rhytm_ORCH.mp3'")
print(client.read())

When I execute:
in Audacity get popup error window:
Error importing …
File “C:/Dropbox/Python/Audio_prepare_new_project/pre_000_rhytm_ORCH.mp3” not found.

  • The path is 100% correct
    in command i am using apostrophe
    and I want upload mp3

Can you help me?

Try it with a file that’s in a normal folder (not dropbox).

Thank you for your quick help Steve…
I change folder to C:\new_project (no Dropbox)
I run program from VSCode …
I run direct python file from CMD
I change apostrofe (" " and ’ ')
I change slash

client.write('Import2: Filename="C:\\new_project\\a.mp3"')

same error
Btw, program open another text file and work with folders … and no problem.

Audacity version 3.0.2 (not possible use higher)

solved
sorry … this combination in my case is OK
slash: /
and apostrofe conversely

client.write('Import2: Filename="C:/Dropbox/Python/Audio_prepare_new_project/a.mp3"')

thank you very much for your awesome work!!!
Ivo

Be careful with the dropbox folder.

Many people have lost their projects when the project “.AUP3” is in a dropbox directory (or any other cloud synchronised folder).
The problem is that if the cloud drive decides to synchronise the .AUP3 file, it will corrupt the file. These kind of directories are not safe to use with database files (the “AUP3” file is an SQLite database).