Skip to main content

Python package for issuing scripting commands to Audacity.

This comprises a set of Command classes, each of which represents a single Audacity scripting command. These can be issued to a running Audacity process with the cheek.commands.do() function.

There is also a command-line interface which has a subcomand for each scripting command. This allows you to drive Audacity using a shell or other non-Python interface.

Command classes

The scripting command classes are implemented in the cheek.commands submodule as subclasses of cheek.commands.Command. These use pydantic to express their arguments. NB: we automatically generate these classes based on the output of Audacity’s GetInfo command. See below for more details.

At the time of writing, not all Audacity scripting commands are fully implemented. In particular, those which require parameters are not all done. Those without parameters are generally complete, though there may be bugs or gaps.

Basic programmatic use of a command is something like this:

from cheek.commands import AddLabel, SetLabel, do

do(
    AddLabel(),
    SetLabel(Label=0, Text="Label text", Start=123.456)
)

From the command line that might look like this:

cheek AddLabel
cheek SetLabel --Label 0 --Text "Label text" --Start 123.456

Tests

There are a few tests, though we’re very, very far from comprehensive. Really, since real testing would require determing that Audacity was doing the right thing, it’s probably not practical to really test this too fully. But if you’ve got ideas about testing, we could merge them in.

Re-generating the Command subclasses

We can use the output from the scripting command “GetInfo” to regenerate all of the Command subclasses. Right now this is a bit rough, but here’s what to do.

First, execute “GetInfo(‘Commands’, ‘JSON’)” and capture the output. You can do this with cheek itself, or pyaudacity, or whatever. The JSON you get is likely to be invalid at first, so you’ll need to clean it up. It should be clear how to do this.

Save this cleaned-up JSON to a file, e.g. “commands.json”. Then run:

python -m cheek.extract commands.json > src/cheek/commands.py

That should do it. You may want to run this generated Python through a formatter, though it should be valid Python as-is. Commit the new commands.py to git and you’ll have an updated command set. Copyright (c) 2024 Austin Bingham

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for cheek 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cheek 0.0.1
File Size Uploaded
cheek-0.0.1.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cheek 0.0.1
File Interpreter ABI Platform
cheek-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.4 kB

Release files / cheek-0.0.1.tar.gz

Download URL cheek-0.0.1.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cfb5096a621b6d4b49a2a3b79c46c0ef3cff4b767a4bb7780845a22ca5e5df87
BLAKE2b-256 checksum
How to use checksums
33b0b1f09e5f3e406c27ba627d425d305a023f7080792c8f8e0355d4e46ecea3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.0

Release files / cheek-0.0.1-py3-none-any.whl

Download URL cheek-0.0.1-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c591c956503b1405cce3a0fbbaf46d66129e08c379b2b8dd225c96a0229afa36
BLAKE2b-256 checksum
How to use checksums
33832faa6d1af9b007576a8c107bacf71e7d4c28df8df83249774b38247871b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page