Skip to main content

Audacity Scripting - Python package for automating Audacity

Project description

audacity-scripting

PyPI

A Python package for automating Audacity tasks based on Audacity's Scripting Reference.

https://github.com/unfor19/audacity-scripting/assets/15122452/080e772c-3e40-424b-87ce-c2ac0dd75570

Music by Sergio Prosvirini from Pixabay

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

Known Issues

  • macOS prints Audacity's server logs (Server sending, Read failed on fifo, quitting, etc.) - documented in JOURNEY.md

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:
  add-labels     Alias: al Add labels to clips in a given project
  clean-spaces   Alias: cs Clean spaces between clips in a given project
  do-command     Alias: dc - Execute a raw command in Audacity
  testing        This is for testing purposes only
  version-print  Get the version from the version file.

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: Tracks=0.0 Start=0.0 End=0.0"

Contributing

Expand/Collapse

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
      
  • 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.

  1. Fork this repository on GitHub

  2. Git clone your forked repository

  3. 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)
    
  4. Prepare .VENV directory - This step also installs the latest version of pip and wheel

    make venv-prepare
    
  5. IMPORTANT: The Makefile activates .VENV for any venv- target.

  6. Install this package's development requirements.txt in .VENV

    make venv-install
    
  7. 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

  1. Checkout to a new branch feature/my-awesome-feature
  2. (Optional) Add a new Python package and update ./requirements.txt accordingly
    make venv-install PACKAGE_NAME=click==8.1.7
    
    make venv-requirements-update
    
  3. Add tests on your feature in ./tests; all tests are based on the Python's unittest framework
  4. Run tests - This wrapper command kills existing Audacity instances, cleans up test outputs, starts Audacity, and then starts the tests.
    make wrapper-run-test
    
  5. Commit changes to your cloned fork
    git commit -am "added an awesome feature"
    
  6. 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.

References

Authors

Created and maintained by Meir Gabay

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

audacity_scripting-1.0.6.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

audacity_scripting-1.0.6-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file audacity_scripting-1.0.6.tar.gz.

File metadata

  • Download URL: audacity_scripting-1.0.6.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for audacity_scripting-1.0.6.tar.gz
Algorithm Hash digest
SHA256 03d6af06135e6eb97d0f9fe0b021d2cc92a474a66fcfb1c4171504932e0258c1
MD5 cadc4e0fddbedb3e2f8971a08030b6fe
BLAKE2b-256 6594bea9aa75dfe653b51a4d0dcc7013adcc908e3cf1e4674900eed5ba6819d9

See more details on using hashes here.

File details

Details for the file audacity_scripting-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for audacity_scripting-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e105c1746dbd889ed9145ef7ad1d25160bf7379aa9897ff8625f99ddd8be9021
MD5 dc3e12e15db79a10fa820fbeaa568f54
BLAKE2b-256 92860ca0ee52dcfcb99c6b72845c6898841a5ba749ef34c5fada02d16fa47909

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page