Audacity Scripting - Python package for automating Audacity
Project description
audacity-scripting
A Python package for automating Audacity tasks based on Audacity's Scripting Reference.
Requirements
- Install Python 3.9+
- Install Audacity 3.4.2+
- Audacity - Enable mod-script-pipe
- Run Audacity
- Go into Edit > Preferences > Modules
- Choose mod-script-pipe (which should show New) and change that to Enabled.
- Restart Audacity
- Check that it now does show Enabled.
- This establishes that Audacity is finding mod-script pipe and that the version is compatible.
Installation
python -m pip install audacity-scripting
Features
- Remove spaces between clips - Removes spaces in all tracks for a given project absolute path
/path/to/my_project.aup3
- Clean silence
- Normalize audio
- Prepare videos for voice-clone-finetuning-vits
Available Commands
Auto-generated by unfor19/replacer-action, see readme.yml
Usage: audacity_scripting [OPTIONS] COMMAND [ARGS]...
No confirmation prompts
Options:
-ci, --ci Use this flag to avoid confirmation prompts
--help Show this message and exit.
Commands:
clean-spaces Alias: cs
do-command Alias: dc - Execute a raw command in Audacity
testing This is for testing purposes only
Getting Started
All the commands assume that the Audacity application is up and running; That is mandatory as we communicate with Audacity's pipe to execute all the commands.
NOTE: See the GitHub Actions Tests Workflow to check it in action.
Remove spaces between clips
This command copies the original file and removes spaces (gaps) between audio clips from the copied file.
audacity_scripting clean-spaces --path "/path/to/my_project.aup3"
Send a command to Audacity
Send a command to Audacity according to Audacity's Scripting Reference.
audacity_scripting do-command --command "Select: Track=0 Track=1"
Contributing
This section assumes you've completed the Requirements section.
Development Requirements
-
macOS
- Install HomeBrew Package Manager
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install required packages with HomeBrew
brew install make
- Install HomeBrew Package Manager
-
Windows
-
Install Chocolatey Package Manager
-
Install required packages with Choco
IMPORTANT: Open a PowerShell window with elevated permissions (As Administrator)
choco install -y make
-
From now on, we'll use make
commands to develop and build this Python package locally.
-
Fork this repository on GitHub
-
Git clone your forked repository
-
Add this repository as a "source" remote
cd audacity-scripting
git remote add source https://github.com/unfor19/audacity-scripting.git
Check git remotes
git remote -v
Assuming you are
willywonka
, here's the desired output:origin https://github.com/willywonka/audacity-scripting.git (fetch) origin https://github.com/willywonka/audacity-scripting.git (push) source https://github.com/unfor19/audacity-scripting.git (fetch) source https://github.com/unfor19/audacity-scripting.git (push)
-
Prepare
.VENV
directory - This step also installs the latest version ofsetuptools
,pip
wheel
, and a specific version fortwine==3.1.1
*.make venv-prepare
* Using the latest twine version fails in CI/CD, so using
3.1.1
for now -
IMPORTANT: The Makefile activates
.VENV
for anyvenv-
target. -
Install this package's development
requirements.txt
in.VENV
make venv-install
-
Install this package in edit mode
IMPORTANT: For any change in ./src/audacity_scripting/cli/, it's best to re-run this command to update the CLI commands; see Click Framework.
make venv-install-edit
You can now start the development process!
Development Process
- Checkout to a new branch
feature/my-awesome-feature
- (Optional) Add a new Python package and update ./requirements.txt accordingly
make venv-install PACKAGE_NAME=click==8.1.7
make venv-requirements-update
- Add tests on your feature in ./tests; all tests are based on the Python's unittest framework
- Run tests - This wrapper command kills existing Audacity instances, cleans up test outputs, starts Audacity, and then starts the tests.
make wrapper-run-test
- Commit changes to your cloned fork
git commit -am "added an awesome feature"
- Create a GitHub Pull Request from your fork to the source repository.
Syncing with the "source" code
You've already added source
as a git remote, to sync from source
to your current branch, execute this command:
git pull source main
Following that, you might need to handle some merge conflicts, but that's it; you're up-to-date with the latest version of the source code.
Known Issues
- macOS prints Audacity's server logs (
Server sending
,Read failed on fifo, quitting
, etc.) - documented in JOURNEY.md
References
- GitHub Issue - Audacity Remove spaces between clips
- SourceForge Issue - Audacity pipes
- GitHub Actions Windows Pipes Discussion
- Audacity pipes issue on Windows
- Python and Windows named pipes on Stackoverflow
Authors
Created and maintained by Meir Gabay
License
This project is licensed under the MIT License - see the LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for audacity_scripting-9.9.9rc99.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82d9cee4af9b98bb8a17592c627438c64d7209702eb938d669b7ca2b6580a5dd |
|
MD5 | d8bcd5a9f877be16cd9f590993c241ed |
|
BLAKE2b-256 | 5e9b58dc8d05e1f3c41302e3774a85123d4aac0deb36ca609a3a323b50eb1960 |
Hashes for audacity_scripting-9.9.9rc99-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c027c739c7128e2f77d0b12ad5b9a671f8fd1ccac042f92d16e6f3bee07b9bd |
|
MD5 | f47ed29318549ebeadf34444e44ebd32 |
|
BLAKE2b-256 | 1147335c5643c126f64cbd9e1e9adf416973979ae7787316dc3dfe0e967c5691 |