What the tools do
A tour of the tools by task. Every tool with every argument is in the
tool reference. Track index -1 is the master track everywhere; edits run inside
REAPER undo blocks.
Bridge and REAPER
health reports whether the bridge heartbeat is fresh. reload_bridge re-reads the Lua handlers
after an update, without restarting REAPER. audio_device reads, closes or opens REAPER’s audio
and MIDI devices.
On Windows, three tools work even when REAPER’s Lua thread is stuck, because they do not go
through the bridge: inspect_reaper_windows reports REAPER processes, visible windows, owned
dialog text and whether the main window responds; close_reaper_fx_windows posts WM_CLOSE to
visible owned dialogs whose title starts with the given title_prefix; restart_bridge asks the
installed REAPER to load the bridge again. None of them terminates REAPER.
Projects and tabs
get_project_info (name, tempo, time signature, track count, sample rate, length, and the play
rate: a render lasts length / play rate), open_project,
save_project, set_project_sample_rate. Project tabs: list_projects, switch_project,
new_project_tab and close_project_tab. Closing requires index, keeps the active tab
active and refuses a tab with unsaved changes or the last tab.
get_project_notes and set_project_notes read and write the project notes, title and author
(Project Settings / Notes), saved with the project: a place to leave notes for the next session.
show_on_load says whether the saved file opens the notes window on load, which blocks REAPER
(see Configuration); REAPER’s API cannot change it, so it is
read from the saved file and is null for a project never saved.
get_ext_state, set_ext_state and delete_ext_state keep named values by section and key.
Scope project (the default) is saved in the project file, and get_ext_state without a key lists
a section; REAPER keeps project keys in upper case and finds them in any case. Scope global is
kept by REAPER for every project, until it quits or, with persist, for good; it cannot be listed.
project_snapshot returns the whole project in one call: tracks, folders, faders, FX, sends, item
counts and master FX. Compare two snapshots to see what changed. list_plugins lists the plugins
in use with their instance count and the VST3 version on disk. REAPER keeps an old DLL loaded
after an update, so a newer version on disk needs a REAPER restart.
Transport, cursor and undo
get_transport reads the play state (stopped, playing, paused, recording), the play position, the
edit cursor in seconds and bar.beat, the time selection, the loop range and whether repeat is on.
transport plays, stops, pauses or records (on the armed tracks) and turns repeat on or off.
set_edit_cursor moves the cursor to seconds or to a bar and beat; set_time_selection sets or
clears the time selection, or with loop the loop range, by seconds or bars. With REAPER’s default
setting the loop points are linked to the time selection, so the other range follows.
undo and redo step through REAPER’s undo history (steps, default one) and return the names of
the steps, for example MCP: rename track, so an agent can take back its own edits.
Tracks and folders
list_tracks, get_track, create_track, rename_track, delete_track, and set_track for the
fader in dB, pan, mute, solo, phase, master send, channel count and the whole FX chain’s enable
state. describe_track shows everything that sets the level and sound of one track (fader, pan, FX
chain with pin mappings, envelopes, sends, receives) and notes what acts after the plugins, for
example an active volume envelope that shifts a limiter’s ceiling.
set_track also sets the track color (#rrggbb, or none) and recording: record_arm,
record_input ({"kind": "audio", "channel": 1, "channels": "stereo"}, {"kind": "midi", "device": "all", "channel": 0} or {"kind": "none"}), monitor (off, on, tape) and
record_mode (input, the track output in stereo or mono, midi_overdub, midi_replace …).
list_inputs names the audio inputs and MIDI devices of the machine. Track descriptions report all
of them.
set_track also sets the automation mode (trim_read, read, touch, write, latch,
latch_preview); set_global_automation_override overrides it for all tracks (none or
bypass among others). set_track_group puts a track in one of 64 track groups for chosen
parameters (volume, pan, mute, solo, record_arm, polarity …) as lead, follower or both,
and get_track_groups reads them back. select_tracks, select_items and get_selection set and
read the selection that some REAPER actions work on.
Folders: move_track reorders one track (before_index); set_track_folder_depth sets the
folder depth (1 starts a folder, 0 normal, -1..-16 closes levels). Reorder first, then set depths;
routing is not changed. delete_track with with_children also removes the inside of a folder.
Multi-output instruments such as Kontakt: probe_instrument_outputs renders a short range of
every output pair to its own file and reports what plays there (loudness, peak, loudest band;
silent pairs are marked), and create_multiout_tracks creates one track per output pair, each
fed by a send from the instrument.
Templates and FX chains
export_mix_template writes item-free .RTrackTemplate files for the mix groups DRUMS, BASS,
GUITARS, VOCALS, MIX BUS and RETURNS, plus master.RfxChain unless include_master_chain is
false. It keeps FX, folder contents and the receives inside a group (remapped to template-local
indexes); receives from outside a group are dropped and counted in the result.
apply_track_fx_template copies only the static FX state of a named template track to a project
track. It keeps the destination’s media, routing, pan, fader and non-FX envelopes. The default
mode is replace; append adds the FX after the existing chain and keeps its automation.
REAPER has no function that writes a plugin preset, so export_fx_chain writes the FX of a track
(all, or the ones named in fx) to an .RfxChain file with the plugin states inside, and
import_fx_chain puts such a file on a track (append or replace). Use a chain file for “this
guitar amp sound”; a whole group with its tracks, routing and FX is a track template.
FX and parameters
list_fx, add_fx, remove_fx, move_fx, set_fx_enabled, presets with list_fx_presets (names
every preset and leaves the plugin as it was) and set_fx_preset, and pin mappings with get_fx_pins and set_fx_pins.
Parameters: list_fx_params, set_fx_param and set_fx_params (several in one undo step). A
parameter is found by index, exact name or a case-insensitive part of the name, and set by
normalized value, by the number the plugin displays (display_value, solved by bisection) or by
its displayed text (display_text, for switches and choices). list_fx_param_choices lists the
texts a switch can show, and format_fx_param shows how the plugin would display a value.
FX containers (REAPER 7): create_fx_container adds one at the end of the chain, or with
container inside another container. move_fx_to_container moves an FX into a container at any
depth at a position, and move_fx_out_of_container moves one back to the top level. list_fx_tree
shows the chain as a tree with an address for every FX. An address inside a container works as fx
in the other FX tools. Addresses inside containers depend on the FX counts of the chains above, so
they change when FX are added, removed or moved: take them from the tree the move tools return.
Modulation: set_param_modulation drives a parameter from an LFO (shape, speed, strength, phase,
tempo sync) and/or an audio control signal (an envelope follower with attack, release and a dB
range, for example from a sidechain on channels 3/4) around a baseline; set_param_link makes a
parameter follow another FX parameter with a scale and offset; get_param_modulation reads all of
it.
Take FX: every tool in this section, the FX envelope and the modulation tools also take item;
with it they work on the FX chain of that item’s active take instead of the track’s
(add_fx {"track": 2, "item": 0, "name": "ReaEQ"}). FX chain files and containers are for tracks
only.
Sends and routing
list_sends, create_send, set_send, remove_send. A send takes source_channel and
dest_channel (the first channel of a pair: 0 = 1/2, 2 = 3/4, 4 = 5/6 …; this is how a multi-out
plugin feeds several tracks), mono, phase_inverted and mode (0 post-fader, 1 pre-FX,
3 post-FX). REAPER cannot change the destination of a send: create the new one and remove the old
one.
Hardware outputs send a track straight to an output of the audio interface (a click for the drummer,
a headphone mix, outboard gear): list_hardware_outputs, create_hardware_output,
set_hardware_output and remove_hardware_output take a 1-based output_channel (see
list_outputs), mono, source_channel, level, pan, mute and mode like sends.
Items and media
list_items reports position (also as bar.beat), length, gain, mute, take pan, channel mode,
source file, source channels and the take start_offset: a slip edit, so the file’s audio appears
at position - start_offset. set_item changes gain, mute, position, length, start_offset,
take pan, channel mode and source (play another file). insert_media and delete_item add and
remove items; set_items_time_base sets how items follow tempo changes.
normalize_items uses REAPER’s own normalization (the calculation behind Item processing >
Normalize): it sets the item gain so that the part of the source an item plays reaches
target_db in peak, true_peak, lufs_i, lufs_m, lufs_s or rms. dry_run only
reports.
split_items splits every item of the given tracks that crosses a position (seconds, or bar and
beat); the right part plays on from where the left part stops. set_item also sets fades (length
and shape: linear, fast_start, fast_end, fast_start_steep, fast_end_steep,
slow_start_end, slow_start_end_steep), the take’s play rate with or without preserving pitch,
and its pitch in semitones; list_items reports them.
Takes: list_takes, add_take (another file as a new take; the active take stays unless
activate) and set_active_take. Stretch markers (list_stretch_markers, set_stretch_markers)
pin a source position to a position on the item, so the audio between markers stretches; take
markers (list_take_markers, set_take_markers) are named points in a take’s source. Both set
tools replace the markers of the active take; an empty list removes them.
set_media_offline closes (or reopens) the file of every item that plays it, so the file can be
rewritten; otherwise REAPER holds it open (PermissionError on Windows).
Musical time, tempo and markers
Move by musical time instead of seconds, which leave the grid as soon as the tempo is not round.
move_items moves the items of tracks (or one item) by bars, beats, the project grid or note
values (1/4..1/64), optionally snapped to a grid, with the automation points
(include_envelopes) and folder contents (with_children); dry_run shows the positions first.
set_item_position puts one item at a bar and beat; get_grid shows tempo, time signature, grid
size and the length of a bar.
set_tempo_map writes tempo markers given in quarter notes (the unit of a MIDI file or a Cubase
tempo track), so MIDI placed by seconds lands on the bars of the audio. add_markers adds markers
and regions by project seconds with an optional #rrggbb color; list_markers lists them. Each marker can also change the time signature (numerator, denominator); get_tempo_map
lists the markers with their bar.beat position and the signature in effect, and get_grid with
seconds or bar reports the tempo and signature at that point. set_marker changes one marker
or region by its number (name, position, end, color) and delete_marker removes one.
go_to_marker moves the edit cursor (and the play position while playing) to a marker or region
by number or name, and get_markers_at names the last marker at or before a time and the region
around it, at the edit cursor by default.
MIDI
create_midi_item, add_midi_notes and list_midi_notes (start and end in project seconds,
pitch, velocity, note count per pitch, pitch filter). set_midi_notes changes notes by index
(pitch, velocity, channel, start, end, mute) and delete_midi_notes removes them by index, by pitch
and time range, or all. MIDI channels are 0-15 in these tools.
list_midi_events, add_midi_events and delete_midi_events handle everything that is not a
note: CC (with the curve to the next point: square, linear, slow, fast_start, fast_end,
bezier), pitch bend (-8192 to 8191), program change, channel pressure, poly aftertouch, text,
lyric, marker, cue and sysex events (bytes in hex without F0 and F7). quantize_midi moves note
starts toward the project grid or a note value (triplets too) with a strength in percent, keeping
lengths unless ends is true.
humanize_midi loosens notes at random within limits: starts move by up to timing_ms either way,
lengths change by up to length_percent and velocities by up to velocity (kept within 1-127), and
no note moves before the item start. The random numbers come from seed: the same seed on the same
notes gives the same result, and the result reports the seed used. pitch and a range of note
starts (start_seconds, end_seconds) limit which notes change.
Automation
set_envelope_points writes the points of a track envelope: Volume with value_db, Pan, or an
FX parameter with fx; a missing envelope is created and shown. set_fx_envelope does the same
for one FX parameter. list_track_envelopes lists volume, trim, pan, width, mute and plugin
envelopes with their state and range; set_envelope_active switches one on or off without
deleting it, and delete_envelope removes a track or FX parameter envelope with its lane.
Take envelopes: set_take_envelope_points writes the Volume (value_db), Pan, Mute or Pitch
(semitones) envelope of an item’s active take, creating it if missing; point times are seconds
from the item start. list_take_envelopes lists them.
Automation items on an existing track or FX parameter envelope: insert_automation_item (from the
envelope points in its range, or as a new instance of a pool with pool_id), set_automation_item
(position, length, start offset, rate, baseline, amplitude, loop), delete_automation_item and
list_automation_items.
Rendering
get_render_settings, render_project, render_stems and render_variants. Render tools delete
the files they are about to write (overwrite: false keeps them), because REAPER never overwrites
and writes NAME-001.wav next to the old file, which a caller then reads by mistake. The result
lists the written files with their sizes and warns when one is missing. fresh: true saves and
reopens the project before rendering. render_variants renders the same stems several times with
different tracks muted per variant and restores the mutes.
render_regions renders every region to its own file (pattern $region by default), through the
master mix or, with use_matrix, through the region render matrix, with the same safe behaviour:
the files REAPER is about to write are deleted first and the written files are listed.
get_region_render_matrix and set_region_render_matrix read and set which tracks each region
renders (-1 is the master mix).
Audio analysis
These work on WAV files and need no REAPER. analyze_audio reports integrated loudness, loudness
range, sample peak, samples above full scale, crest factor, stereo width and the spectrum in
third-octave and mixing bands, for a whole file or a time range. compare_audio compares two
files (for example a render against a reference) with the second turned to the loudness of the
first, so the band differences describe tone and not volume. Render analysis files as float32
(render_project and render_stems take a format) so that levels above 0 dBFS are not cut off.
analyze_item and analyze_track give the same numbers without a render: the bridge reads the
audio through REAPER’s audio accessors at the project sample rate and the server analyses it. An
item is read from its active take, with take FX, take volume and pitch, in seconds from the item
start; a track is read in project time as its items play, before track FX, sends and the fader
(render to hear those). Both add peaks, an overview of peak_windows (default 20) stretches in
project time with the peak of each and silent below -60 dBFS, to find where something is loud or
quiet. One call reads at most 30 minutes.
Batches and actions
batch runs a list of {tool, args} in one call and stops at the first error
(continue_on_error goes on). It runs the Lua handlers directly, so the arguments are the tools’
own. run_action runs a REAPER action by numeric ID or named command: a stop-gap until a feature
gets its own tool.
To find an action and use it safely, search_actions looks up REAPER’s action list (main section)
by words in the name and reports each action’s ID, named command and on/off state.
get_action_state reads one action’s state, and set_action_state switches a toggle action on or
off, running it only when its state differs, so calling it twice does not flip it back.