render_project
Render a REAPER project to an audio file in WAV, FLAC, MP3, or OGG format with configurable sample rate, bit depth, and channel count.
Instructions
Render the entire project to a file. format: wav, flac, mp3 (requires LAME), ogg. sample_rate: e.g. 44100, 48000, 96000. bit_depth: 16, 24, or 32 (WAV only; ignored for mp3/ogg/flac). channels: 1 (mono) or 2 (stereo).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | Yes | ||
| format | No | wav | |
| sample_rate | No | ||
| bit_depth | No | ||
| channels | No |
Implementation Reference
- src/reaper_mcp/render_tools.py:62-94 (handler)The render_project function is the main tool handler. It sets render settings via _set_render_settings, executes REAPER's render command (Main_OnCommand 41824), checks if the output file exists, and returns success/failure with metadata.
def render_project( output_path: str, format: str = "wav", sample_rate: int = 48000, bit_depth: int = 24, channels: int = 2, ) -> dict: """ Render the entire project to a file. format: wav, flac, mp3 (requires LAME), ogg. sample_rate: e.g. 44100, 48000, 96000. bit_depth: 16, 24, or 32 (WAV only; ignored for mp3/ogg/flac). channels: 1 (mono) or 2 (stereo). """ try: output_path = str(Path(output_path).expanduser().resolve()) os.makedirs(os.path.dirname(output_path), exist_ok=True) _set_render_settings(output_path, format, sample_rate, bit_depth, channels, bounds=0) RPR.Main_OnCommand(41824, 0) # File: Render project to disk (no dialog) if not os.path.exists(output_path): return {"success": False, "error": "Render command completed but output file not found"} return { "success": True, "output_path": output_path, "format": format, "sample_rate": sample_rate, "bit_depth": bit_depth, "channels": channels, "file_size_bytes": os.path.getsize(output_path), } except Exception as e: logger.error(f"render_project failed: {e}") return {"success": False, "error": str(e)} - src/reaper_mcp/render_tools.py:62-74 (schema)The function signature and docstring define the input schema for render_project: output_path (str, required), format (str, default wav), sample_rate (int, default 48000), bit_depth (int, default 24), channels (int, default 2).
def render_project( output_path: str, format: str = "wav", sample_rate: int = 48000, bit_depth: int = 24, channels: int = 2, ) -> dict: """ Render the entire project to a file. format: wav, flac, mp3 (requires LAME), ogg. sample_rate: e.g. 44100, 48000, 96000. bit_depth: 16, 24, or 32 (WAV only; ignored for mp3/ogg/flac). channels: 1 (mono) or 2 (stereo). - src/reaper_mcp/render_tools.py:59-61 (registration)The render_project function is registered as an MCP tool via the @mcp.tool() decorator inside register_tools(mcp). render_tools.register_tools is imported in server.py and called with the mcp instance.
def register_tools(mcp): @mcp.tool() - src/reaper_mcp/render_tools.py:28-44 (helper)_set_render_settings is a helper function called by render_project. It uses REAPER's API (GetSetProjectInfo_String, GetSetProjectInfo) to configure render output path, format, bit depth, sample rate, channels, and bounds flags.
def _set_render_settings( output_path: str, format: str, sample_rate: int, bit_depth: int, channels: int, bounds: int, ) -> None: """Configure REAPER's render settings. bounds: 0=entire project, 1=time selection.""" fmt_code = FORMAT_CODES.get(format.lower(), 0) bdepth_code = BIT_DEPTH_CODES.get(bit_depth, 2) RPR.GetSetProjectInfo_String(0, "RENDER_FILE", output_path, True) RPR.GetSetProjectInfo(0, "RENDER_FORMAT", fmt_code, True) RPR.GetSetProjectInfo(0, "RENDER_FORMAT2", bdepth_code, True) RPR.GetSetProjectInfo(0, "RENDER_SRATE", float(sample_rate), True) RPR.GetSetProjectInfo(0, "RENDER_CHANNELS", float(channels), True) RPR.GetSetProjectInfo(0, "RENDER_BOUNDSFLAG", float(bounds), True) - src/reaper_mcp/server.py:16-28 (registration)The render_tools module is imported into server.py and its register_tools function is called to register the render_project tool on the FastMCP instance.
from reaper_mcp.render_tools import register_tools as _reg_render from reaper_mcp.mastering_tools import register_tools as _reg_mastering from reaper_mcp.analysis_tools import register_tools as _reg_analysis _reg_project(mcp) _reg_track(mcp) _reg_midi(mcp) _reg_fx(mcp) _reg_audio(mcp) _reg_mixing(mcp) _reg_render(mcp) _reg_mastering(mcp) _reg_analysis(mcp)