Scripting Reference

This page lists scripting commands.

Yes these are the same commands as in the menus, same as in "Commands and Shortcuts" too, just presented differently.

  • Presented in a format useful to people using:
  • Macros or
  • Python Scripting or
  • AUD-DO.
  • Most of this page is automatically generated.

A few commands are intentionally omitted from the Macro Manager (such as "Close:") because they are unsuitable for use in Macros.

| Advice | This table shows the items in the menus that are scriptable. - The Scripting Ids, parameters and defaults are all likely to change between versions. - Boolean values must be given as 1 (true) or 0 (false). |

File Menu

The File Menu provides commands for creating, opening and saving Audacity projects and importing and exporting audio files

Scripting Id Action Parameters Description
New: New none Creates a new empty project window, to start working on new or imported tracks.
Open: Open none Presents a standard dialog box where you can select either audio files, a list of files (.LOF) or an Audacity Project file to open.
Close: Close none Closes the current project window, prompting you to save your work if you have not saved.
SaveProject: Save Project none Various ways to save a project.
ExportAudio: Export Audio none Export audio files in various formats.
PageSetup: Page Setup none Opens the standard Page Setup dialog box prior to printing
Print: Print none Prints all the waveforms in the current project window (and the contents of Label Tracks or other tracks), with the Timeline above. Everything is printed to one page.
Exit: Exit none Closes all project windows and exits Audacity. If there are any unsaved changes to your project, Audacity will ask if you want to save them.

File: Save Project

Various ways to save a project.

Scripting Id Action Parameters Description
Save: Save Project none Saves the current Audacity project .AUP3 file.
SaveAs: Save Project As none Same as "Save Project" above, but allows you to save a copy of an open project to a different name or location
SaveCopy: Save Lossless Copy of Project none Saves the current Audacity project .AUP3 file.
SaveCompressed: Save Compressed Copy of Project none Saves in the audacity .aup3 project file format, but compressed (Suitable for mailing)

File: Export Other

For exporting audio files

Scripting Id Action Parameters Description
ExportLabels: Export Labels none Exports audio at one or more labels to file(s).
ExportMIDI: Export MIDI none Exports MIDI (note tracks) to a MIDI file.

File: Import

For importing audio files or label files into your project

Scripting Id Action Parameters Description
ImportAudio: Audio none Similar to 'Open', except that the file is added as a new track to your existing project.
ImportLabels: Labels none Launches a file selection window where you can choose to import a single text file into the project containing point or region labels. For more information about the syntax for labels files, see Importing and Exporting Labels.
ImportMIDI: MIDI none Imports a MIDI (MIDI or MID extension) or Allegro (GRO) file to a Note Track where simple cut-and-paste edits can be performed. The result can be exported with the File > Export> > Export MIDI command. Note: Currently, MIDI and Allegro files cannot be played.
ImportRaw: Raw Data none Attempts to import an uncompressed audio file that might be "raw" data without any headers to define its format, might have incorrect headers or be otherwise partially corrupted, or might be in a format that Audacity is unable to recognize. Raw data in textual format cannot be imported.

Edit Menu

The Edit Menu provides standard edit commands (Undo, Redo, Cut, Copy, Paste and Delete) plus many other commands specific to editing audio or labels

Scripting Id Action Parameters Description
Undo: Undo none Undoes the most recent editing action.
Redo: Redo none Redoes the most recently undone editing action.
Cut: Cut none Removes the selected audio data and/or labels and places these on the Audacity clipboard. By default, any audio or labels to right of the selection are shifted to the left.
Delete: Delete none Removes the selected audio data and/or labels without copying these to the Audacity clipboard. By default, any audio or labels to right of the selection are shifted to the left.
Copy: Copy none Copies the selected audio data to the Audacity clipboard without removing it from the project.
Paste: Paste none Inserts whatever is on the Audacity clipboard at the position of the selection cursor in the project, replacing whatever audio data is currently selected, if any.
Duplicate: Duplicate none Creates a new track containing only the current selection as a new clip.
EditMetaData: Metadata none The Metadata Editor modifies information about a track, such as the artist and genre. Typically used with MP3 files.
Preferences: Preferences none Preferences let you change most of the default behaviors and settings of Audacity. On Mac, Preferences are in the Audacity Menu and the default shortcut is ⌘ + ,.

Edit: Remove Special

For more "advanced" removal of audio

Scripting Id Action Parameters Description
SplitCut: Split Cut none Same as Cut, but none of the audio data or labels to right of the selection are shifted.
SplitDelete: Split Delete none Same as Delete, but none of the audio data or labels to right of the selection are shifted.
Silence: Silence Audio none Replaces the currently selected audio with absolute silence. Does not affect label tracks.
Trim: Trim Audio none Deletes all audio but the selection. If there are other separate clips in the same track these are not removed or shifted unless trimming the entire length of a clip or clips. Does not affect label tracks.

Edit: Clip Boundaries

Create or remove separate clips in the audio track. A clip inside an audio track is a separate section of that track which has been split so that it can be manipulated somewhat independently of the other clips in the track.

Scripting Id Action Parameters Description
Split: Split none Splits the current clip into two clips at the cursor point, or into three clips at the selection boundaries.
SplitNew: Split New none Does a Split Cut on the current selection in the current track, then creates a new track and pastes the selection into the new track.
Join: Join none If you select an area that overlaps one or more clips, they are all joined into one large clip. Regions in-between clips become silence.
Disjoin: Detach at Silences none In a selection region that includes absolute silences, creates individual non-silent clips between the regions of silence. The silence becomes blank space between the clips.

Edit: Labels

These commands are to add and edit labels.

Scripting Id Action Parameters Description
EditLabels: Label Editor none Brings up a dialog box showing all of your labels in a keyboard-accessible tabular view. Handy buttons in the dialog let you insert or delete a label, or import and export labels to a file. See Label Editor for more details.
AddLabel: Add Label at Selection none Creates a new, empty label at the cursor or at the selection region.
AddLabelPlaying: Add Label at Playback Position none Creates a new, empty label at the current playback or recording position.
PasteNewLabel: Paste Text to New Label none Pastes the text on the Audacity clipboard at the cursor position in the currently selected label track. If there is no selection in the label track a point label is created. If a region is selected in the label track a region label is created. If no label track is selected one is created, and a new label is created.
TypeToCreateLabel: Type to Create a Label (on/off) none When a label track has the colored focus border, if this option is on, just type to create a label. Otherwise you must create a label first.

Edit: Labeled Audio

Labeled Audio commands apply standard Edit Menu commands to the audio of one or more regions that are labeled. The labels themselves are not affected.

Scripting Id Action Parameters Description
CutLabels: Cut none Same as the Cut command, but operates on labeled audio regions.
DeleteLabels: Delete none Same as the Delete command, but operates on labeled audio regions.
SplitCutLabels: Split Cut none Same as the Split Cut command, but operates on labeled audio regions.
SplitDeleteLabels: Split Delete none Same as the Split Delete command, but operates on labeled audio regions.
SilenceLabels: Silence Audio none Same as the Silence Audio command, but operates on labeled audio regions.
CopyLabels: Copy none Same as the Copy command, but operates on labeled audio regions.
SplitLabels: Split none Same as the Split command, but operates on labeled audio regions or points.
JoinLabels: Join none Same as the Join command, but operates on labeled audio regions or points. You may need to select the audio and use Edit > Clip Boundaries > Join, to join all regions or points.
DisjoinLabels: Detach at Silences none Same as the Detach at Silences command, but operates on labeled audio regions.

Select Menu

Select Menu has commands that enable you make selections of tracks or parts of the tracks in your project.

Scripting Id Action Parameters Description
SelectAll: All none Selects all of the audio in all of the tracks.
SelectNone: None none Deselects all of the audio in all of the tracks.
SelCursorStoredCursor: Cursor to Stored Cursor Position none Selects from the position of the cursor to the previously stored cursor position
StoreCursorPosition: Store Cursor Position none Stores the current cursor position for use in a later selection
ZeroCross: At Zero Crossings none Moves the edges of a selection region (or the cursor position) slightly so they are at a rising zero crossing point.

Select: Tracks

Tracks

Scripting Id Action Parameters Description
SelAllTracks: In All Tracks none Extends the current selection up and/or down into all tracks in the project.
SelSyncLockTracks: In All Sync-Locked Tracks none Extends the current selection up and/or down into all sync-locked tracks in the currently selected track group.

Select: Region

For modifying, saving and restoring a selection.

Scripting Id Action Parameters Description
SetLeftSelection: Left at Playback Position none When Audacity is playing, recording or paused, sets the left boundary of a potential selection by moving the cursor to the current position of the green playback cursor (or red recording cursor). Otherwise, opens the "Set Left Selection Boundary" dialog for adjusting the time position of the left-hand selection boundary. If there is no selection, moving the time digits backwards creates a selection ending at the former cursor position, and moving the time digits forwards provides a way to move the cursor forwards to an exact point.
SetRightSelection: Right at Playback Position none When Audacity is playing, recording or paused, sets the right boundary of the selection, thus drawing the selection from the cursor position to the current position of the green playback cursor (or red recording cursor). Otherwise, opens the "Set Right Selection Boundary" dialog for adjusting the time position of the right-hand selection boundary. If there is no selection, moving the time digits forwards creates a selection starting at the former cursor position, and moving the time digits backwards provides a way to move the cursor backwards to an exact point.
SelTrackStartToCursor: Track Start to Cursor none Selects a region in the selected track(s) from the start of the track to the cursor position.
SelCursorToTrackEnd: Cursor to Track End none Selects a region in the selected track(s) from the cursor position to the end of the track.
SelTrackStartToEnd: Track Start to End none Selects a region in the selected track(s) from the start of the track to the end of the track.
SelSave: Store Selection none Stores the end points of a selection for later reuse.
SelRestore: Retrieve Selection none Retrieves the end points of a previously stored selection.

Select: Spectral

For making a selection of a frequency range.

Scripting Id Action Parameters Description
ToggleSpectralSelection: Toggle Spectral Selection none Changes between selecting a time range and selecting the last selected spectral selection in that time range. This command toggles the spectral selection even if not in Spectrogram view, but you must be in Spectrogram view to use the spectral selection in one of the Spectral edit effects.
NextHigherPeakFrequency: Next Higher Peak Frequency none When in Spectrogram view, snaps the center frequency to the next higher frequency peak, moving the spectral selection upwards.
NextLowerPeakFrequency: Next Lower Peak Frequency none When in Spectrogram views snaps the center frequency to the next lower frequency peak, moving the spectral selection downwards.

Select: Clip Boundaries

For modifying a selection, taking account of clips.

Scripting Id Action Parameters Description
SelPrevClipBoundaryToCursor: Previous Clip Boundary to Cursor none Selects from the current cursor position back to the right-hand edge of the previous clip.
SelCursorToNextClipBoundary: Cursor to Next Clip Boundary none Selects from the current cursor position forward to the left-hand edge of the next clip.
SelPrevClip: Previous Clip none Moves the selection to the previous clip.
SelNextClip: Next Clip none Moves the selection to the next clip.

View Menu

View Menu has commands that determine the amount of detail you see in all the tracks in the project window. It also lets you show or hide Toolbars and some additional windows such as Undo History.

Scripting Id Action Parameters Description
UndoHistory: History none Brings up the History window which can then be left open while using Audacity normally. History lists all undoable actions performed in the current project, including importing.
Karaoke: Karaoke none Brings up the Karaoke window, which displays the labels in a "bouncing ball" scrolling display
MixerBoard: Mixer none Mixer is an alternative view to the audio tracks in the main tracks window. Analogous to a hardware mixer board, each audio track is displayed in a Track Strip.
ShowExtraMenus: Extra Menus (on/off) none Shows extra menus with many extra less-used commands.
ShowClipping: Show Clipping in Waveform none Option to show or not show audio that is too loud (in red) on the wave form.

View: Zoom

Zoom in/out on the horizontal axis. Show more detail or show a longer length of time.

Scripting Id Action Parameters Description
ZoomIn: Zoom In none Zooms in on the horizontal axis of the audio displaying more detail over a shorter length of time.
ZoomNormal: Zoom Normal none Zooms to the default view which displays about one inch per second.
ZoomOut: Zoom Out none Zooms out displaying less detail over a greater length of time.
ZoomSel: Zoom to Selection none Zooms in or out so that the selected audio fills the width of the window.
ZoomToggle: Zoom Toggle none Changes the zoom back and forth between two preset levels.
AdvancedVZoom: Advanced Vertical Zooming none Enable for left-click gestures in the vertical scale to control zooming.

View: Track Size

Controls the sizes of tracks.

Scripting Id Action Parameters Description
FitInWindow: Fit to Width none Zooms out until the entire project just fits in the window.
FitV: Fit to Height none Adjusts the height of all the tracks until they fit in the project window.
CollapseAllTracks: Collapse All Tracks none Collapses all tracks to take up the minimum amount of space.
ExpandAllTracks: Expand Collapsed Tracks none Expands all collapsed tracks to their original size before the last collapse.

View: Skip to

Move forward/backwards through the audio

Scripting Id Action Parameters Description
SkipSelStart: Selection Start none When there is a selection, moves the cursor to the start of the selection and removes the selection.
SkipSelEnd: Selection End none When there is a selection, moves the cursor to the end of the selection and removes the selection.

View: Toolbars

Toolbars can be used to determine which of the Audacity toolbars are displayed. By default all toolbars are shown except Spectral Selection, Cut/Copy/Paste and Spectral Selection

Scripting Id Action Parameters Description
ResetToolbars: Reset Toolbars none Using this command positions all toolbars in default location and size as they were when Audacity was first installed
ShowTransportTB: Transport Toolbar none Controls playback and recording and skips to start or end of project when neither playing or recording
ShowToolsTB: Tools Toolbar none Chooses various tools for selection, volume adjustment, zooming and time-shifting of audio
ShowRecordMeterTB: Recording Meter Toolbar none Displays recording levels and toggles input monitoring when not recording
ShowPlayMeterTB: Playback Meter Toolbar none Displays playback levels
ShowMixerTB: Mixer Toolbar none Adjusts the recording and playback volumes of the devices currently selected in Audio Setup Toolbar
ShowEditTB: Edit Toolbar none Cut, copy, paste, trim audio, silence audio, undo, redo, zoom tools
ShowTranscriptionTB: Play-at-Speed Toolbar none Plays audio at a slower or faster speed than normal, affecting pitch
ShowScrubbingTB: Scrub Toolbar none Controls playback and recording and skips to start or end of project when neither playing or recording
ShowDeviceTB: Device Toolbar none Selects audio host, recording device, number of recording channels and playback device
ShowSelectionTB: Selection Toolbar none Adjusts cursor and region position by keyboard input
ShowSpectralSelectionTB: Spectral Selection Toolbar none Displays and lets you adjust the current spectral (frequency) selection without having to be in Spectrogram view

Transport Menu

Transport Menu commands let you play or stop, loop play, scrub play or record (including timed and sound activated recordings).

Scripting Id Action Parameters Description
RescanDevices: Rescan Audio Devices none Rescan for audio devices connected to your computer, and update the playback and recording dropdown menus in Audio Setup Toolbar

Transport: Playing

These commands control playback in Audacity. You can Start, Stop or Pause playback of the audio in your project.

Scripting Id Action Parameters Description
PlayStop: Play/Stop none Starts and stops playback or stops a recording (stopping does not change the restart position). Therefore using any play or record command after stopping with "Play/Stop" will start playback or recording from the same Timeline position it last started from. You can also assign separate shortcuts for Play and Stop.
PlayStopSelect: Play/Stop and Set Cursor none Starts playback like "Play/Stop", but stopping playback sets the restart position to the stop point. When stopped, this command is the same as "Play/Stop". When playing, this command stops playback and moves the cursor (or the start of the selection) to the position where playback stopped.
Pause: Pause none Temporarily pauses playing or recording without losing your place.

Transport: Recording

These commands control recording in Audacity. You can Start, Stop or Pause recording in your project. You can either start a recording on your existing track or on a new track.

Scripting Id Action Parameters Description
Record1stChoice: Record none Starts recording at the end of the currently selected track(s).
Record2ndChoice: Record New Track none Recording begins on a new track at either the current cursor location or at the beginning of the current selection.
TimerRecord: Timer Record none Brings up the Timer Record dialog.
PunchAndRoll: Punch and Roll Record none Re-record over audio, with a pre-roll of audio that comes before.
Pause: Pause none Temporarily pauses playing or recording without losing your place.

Transport: Scrubbing

Scrubbing is the action of moving the mouse pointer right or left so as to adjust the position, speed or direction of playback, listening to the audio at the same time - a convenient way to quickly navigate the waveform to find a particular event of interest. Speed changes are made by rotating the mouse wheel while scrubbing.

Scripting Id Action Parameters Description
Scrub: Scrub none Scrubbing is the action of moving the mouse pointer right or left so as to adjust the position, speed or direction of playback, listening to the audio at the same time.
Seek: Seek none Seeking is similar to Scrubbing except that it is playback with skips, similar to using the seek button on a CD player.
ToggleScrubRuler: Scrub Ruler none Shows (or hides) the scrub ruler, which is just below the timeline.

Transport: Cursor to

These commands let you move the cursor to the start or end of the selection, track or any adjacent Clip that you may have

Scripting Id Action Parameters Description
CursSelStart: Selection Start none Moves the left edge of the current selection to the center of the screen, without changing the zoom level.
CursSelEnd: Selection End none Moves the right edge of the current selection to the center of the screen, without changing the zoom level.
CursTrackStart: Track Start none Moves the cursor to the start of the selected track.
CursTrackEnd: Track End none Moves the cursor to the end of the selected track.
CursPrevClipBoundary: Previous Clip Boundary none Moves the cursor position back to the right-hand edge of the previous clip
CursNextClipBoundary: Next Clip Boundary none Moves the cursor position forward to the left-hand edge of the next clip
CursProjectStart: Project Start none Moves the cursor to the beginning of the project.
CursProjectEnd: Project End none Moves the cursor to the end of the project.

Transport: Transport Options

This submenu lets you manage and set various options for transport (playing and recording) in Audacity

Scripting Id Action Parameters Description
SoundActivationLevel: Sound Activation Level none Sets the activation level above which Sound Activated Recording will record.
SoundActivation: Sound Activated Recording (on/off) none Toggles on and off the Sound Activated Recording option.
PinnedHead: Enable pinned play head none You can change Audacity to play and record with a fixed head pinned to the Timeline. You can adjust the position of the fixed head by dragging it
Overdub: Hear other tracks during recording none Toggles on and off the Hear other tracks during recording (overdub) option.
SWPlaythrough: Enable audible input monitoring none Toggles on and off the Enable audible input monitoring option.

Tracks Menu

Tracks Menu provides commands for creating and removing tracks, applying operations to selected tracks such as mixing, resampling or converting from stereo to mono, and lets you add or edit labels.

Scripting Id Action Parameters Description
Resample: Resample none Allows you to resample the selected track(s) to a new sample rate for use in the project
RemoveTracks: Remove Tracks none Removes the selected track(s) from the project. Even if only part of a track is selected, the entire track is removed.
SyncLock: Sync-Lock Tracks (on/off) none Ensures that length changes occurring anywhere in a defined group of tracks also take place in all audio or label tracks in that group.

Tracks: Add New

Adds a new track

Scripting Id Action Parameters Description
NewMonoTrack: Mono Track none Creates a new empty mono audio track.
NewStereoTrack: Stereo Track none Adds an empty stereo track to the project
NewLabelTrack: Label Track none Adds an empty label track to the project
NewTimeTrack: Time Track none Adds an empty time track to the project. Time tracks are used to speed up and slow down audio.

Tracks: Mix

Mixes down selected tracks to mono or stereo tracks

Scripting Id Action Parameters Description
Stereo to Mono: Mix Stereo Down to Mono none Converts the selected stereo track(s) into the same number of mono tracks, combining left and right channels equally by averaging the volume of both channels.
MixAndRender: Mix and Render none Mixes down all selected tracks to a single mono or stereo track, rendering to the waveform all real-time transformations that had been applied (such as track gain, panning, amplitude envelopes or a change in Project Sample Rate).
MixAndRenderToNewTrack: Mix and Render to New Track none Same as Tracks > Mix and Render except that the original tracks are preserved rather than being replaced by the resulting "Mix" track.

Tracks: Mute/Unmute

Mutes or unmutes audio tracks in the project

Scripting Id Action Parameters Description
MuteAllTracks: Mute All Tracks none Mutes all the audio tracks in the project as if you had used the mute buttons from the Track Control Panel on each track.
UnmuteAllTracks: Unmute All Tracks none Unmutes all the audio tracks in the project as if you had released the mute buttons from the Track Control Panel on each track.
MuteTracks: Mute Tracks none Mutes the selected tracks.
UnmuteTracks: Unmute Tracks none Unmutes the selected tracks.

Tracks: Pan

Pans left right or center audio tracks in the project

Scripting Id Action Parameters Description
PanLeft: Left none Pan selected audio to left speaker
PanRight: Right none Pan selected audio centrally.
PanCenter: Center none Pan selected audio to right speaker.

Tracks: Align Tracks

Commands that provide an automatic way of aligning selected tracks with the cursor, the selection, or with the start of the project.

Scripting Id Action Parameters Description
Align_EndToEnd: Align End to End none Aligns the selected tracks one after the other, based on their top-to-bottom order in the project window.
Align_Together: Align Together none Align the selected tracks so that they start at the same (averaged) start time.
Align_StartToZero: Start to Zero none Aligns the start of selected tracks with the start of the project.
Align_StartToSelStart: Start to Cursor/Selection Start none Aligns the start of selected tracks with the current cursor position or with the start of the current selection.
Align_StartToSelEnd: Start to Selection End none Aligns the start of selected tracks with the end of the current selection.
Align_EndToSelStart: End to Cursor/Selection Start none Aligns the end of selected tracks with the current cursor position or with the start of the current selection.
Align_EndToSelEnd: End to Selection End none Aligns the end of selected tracks with the end of the current selection.
MoveSelectionWithTracks: Move Selection with Tracks (on/off) none Toggles on/off the selection moving with the realigned tracks, or staying put.

Tracks: Sort Tracks

Sorts all tracks in the project from top to bottom in the project window, by Start Time or by Name.

Scripting Id Action Parameters Description
SortByTime: By Start Time none Sort tracks in order of start time.
SortByName: By Name none Sort tracks in order by name.

Generate Menu

Generate Menu lets you create audio containing tones, noise or silence.

Scripting Id Action Parameters Description
ManageGenerators: Plugin Manager none Selecting this option from the Effect Menu (or the Generate Menu or Analyze Menu) takes you to a dialog where you can enable or disable particular Effects, Generators and Analyzers in Audacity. Even if you do not add any third-party plugins, you can use this to make the Effect menu shorter or longer as required. For details see Plugin Manager.
Built-in: Built-in none Shows the list of available Audacity built-in effects but only if the user has effects "Grouped by Type" in Effects Preferences.
Nyquist: Nyquist none Shows the list of available Nyquist effects but only if the user has effects "Grouped by Type" in Effects Preferences.

Generate: Built-in

Shows the list of available Audacity built-in effects but only if the user has effects "Grouped by Type" in Effects Preferences.

Scripting Id Action Parameters Description
Chirp: Chirp double StartFreq, (default:440) double EndFreq, (default:1320) double StartAmp, (default:0.8) double EndAmp, (default:0.1) enum Waveform, (default:Sine) - Sine - Square - Sawtooth - Square, no alias enum Interpolation*, (

(本文超出站点单文档体积上限,已截断)