Batch Render Multiple Selections into an album and tag metadata

Hello, I think audacity is missing the ability to batch render multiple slices of a track at once like this:

hdHBReE.png
into a folder. And you can additional get metadata from a discogs url to automatically tag the title/artist/ other metadata for each song. I have been doing this using the mod script pipeline with a python3 pip package called vinyl2digital that I made. It works but the mod-script-pipeline is very hard to get working, and it’s not available for linux build users. So I would want to implement a small ui to “Batch Export Audio” similar to batch export selected audio, and you could specify to use default / manual / web tag sources. Would be very convenient and powerful! I would love to make this work, should I compile audacity locally, add this feature, then make a PR? Would that allow this new feature to get added to future builds?
thx, martin

“mod-script-pipe” (the module for Python scripting) should be available in Linux builds (unless you are using a very old version of Audacity, or a “sandboxed” build (Flatpack / Snap packages may be sandboxed and exclude mod-script-pipe).
Audacity 2.3.3 from the Ubuntu 20.04 repository has mod-script-pipe, and it works.

Modules are disabled by default. They have to be enabled in “Edit menu > Preferences > Modules”, and then quit and restart Audacity.

Macros are intentionally limited to a list of commands. No looping. No conditional branching. No advanced programming features.
Even with this narrow scope, Macros are still very powerful tools.
The main developer of Macros considered it very important to avoid making Macros too complicated, as that would exclude the majority of users.

For more “advanced” automation, there are two main options:

  1. Scripting with Python (or any external language that supports “named pipes”)
  2. “Nyquist Macros” (see: https://manual.audacityteam.org/man/nyquist_macros.html)

I think that Python is the way to go with that.
(Nyquist does not have any network connectivity)

Thanks, I finalized and released my mod-script-pipe app: vinyl2digital

https://github.com/MartinBarker/vinyl2digital

https://pypi.org/project/vinyl2digital/

1 Like

help! just updated to audacity 3.4.2 and now my code does not work, specifically this file “init.py” located here: vinyl2digital/vinyl2digital/init.py at master · MartinBarker/vinyl2digital (github.com)

When i start audacity.exe from the win10 command prompt terminal line and ensure mod-script-pipe is enabled:

C:\Users\marti\Documents\projects\vinyl2digital>cd "C:\Program Files\Audacity"

C:\Program Files\Audacity>start Audacity.exe

then i run my script and it always fails with this error

C:\Users\marti\Documents\projects\vinyl2digital>python vinyl2digital\__init__.py
pipe-test.py, running on windows
-- Both pipes exist.  Good.
Traceback (most recent call last):
  File "C:\Users\marti\Documents\projects\vinyl2digital\vinyl2digital\__init__.py", line 31, in <module>
    TOFILE = open(TONAME, 'w')
             ^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '\\\\.\\pipe\\ToSrvPipe'

C:\Users\marti\Documents\projects\vinyl2digital>

this is the code that runs, do i need to update it to connect to the audacity mod-script-pipe correctly?

'''
Audacity mod-script-pipeline setup
'''
# Startup audacity pipe commands
if sys.platform == 'win32':
    print("pipe-test.py, running on windows")
    TONAME = '\\\\.\\pipe\\ToSrvPipe'
    FROMNAME = '\\\\.\\pipe\\FromSrvPipe'
    EOL = '\r\n\0'
else:
    print("pipe-test.py, running on linux or mac")
    TONAME = '/tmp/audacity_script_pipe.to.' + str(os.getuid())
    FROMNAME = '/tmp/audacity_script_pipe.from.' + str(os.getuid())
    EOL = '\n'

if not os.path.exists(TONAME):
    print(" ..does not exist.  Ensure Audacity is running with mod-script-pipe.")
    sys.exit()

if not os.path.exists(FROMNAME):
    print(" ..does not exist.  Ensure Audacity is running with mod-script-pipe.")
    sys.exit()
print("-- Both pipes exist.  Good.")
TOFILE = open(TONAME, 'w')
print("-- File to write to has been opened")
FROMFILE = open(FROMNAME, 'rt')
print("-- File to read from has now been opened too\r\n")

found working python example: GitHub - beattidp/audacity-py-multitone: Python-driven scripted multitone generator, uses mod-script-pipe and Jinja2 templates. Mixes multiple tones and writes output audio files. using this to base my script off, not blocked