project_export_audio
Export the entire Audacity project or current selection to an audio file at a specified path, with channel and format control via file extension.
Instructions
Export the project audio to a file. Format is determined by file extension.
MANDATORY: ALWAYS tell the user where the file will be saved BEFORE exporting. Example: "I'll save your audio to C:\Users\Name\Music\file.mp3"
NEVER save directly to the user's home folder (e.g. ~/file.mp3 or C:\Users\Name\file.mp3). ALWAYS save to a subfolder. If the user doesn't specify a path, call get_default_export_folder to get their Music folder and save there. Acceptable locations:
Music folder: ~/Music/file.mp3
Documents folder: ~/Documents/file.mp3
Desktop: ~/Desktop/file.mp3 NEVER save to the home folder root — this clutters the user's home directory.
Args: path: Absolute path for exported file. Extension determines format (wav, mp3, ogg, flac, aiff). num_channels: Number of channels (1=mono, 2=stereo). Default: 2 whole_project: Select every track and the whole timeline first. Default: True. Audacity's Export2 exports the CURRENT SELECTION, so leaving this on is what makes "export the project" mean the project. Set it to False only when you deliberately want the current selection.
The result carries a verified block read back from the written file:
the container actually present, its sample rate, channels and duration.
Audacity uses the sticky last-used exporter and will write AIFF into a
path named .wav while reporting a WAV export, and it renders at the
project sample rate rather than anything asked for here — so a warning
appears when what landed on disk is not what was requested.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| num_channels | No | ||
| whole_project | No |