A pythonic wrapper for REAPER's ReaScript Python API
- First install from
pip install python-reapy
python -m reapy
Paths to your Python DLL and to
reapy configuration scripts get printed.
If you haven't enabled Python in REAPER yet, go to Options > Preferences... > Plug-ins > ReaScript. Check Enable Python for use with ReaScript, and fill Custom path to Python dll directory and Force ReaScript to use specific Python .dll with the directory path and the file name of the Python DLL.
reapydist API by running the corresponding ReaScript (Actions > Show action list > Reascript : Load... and browse for the script path).
You're all set! You can now import
reapy from inside or outside REAPER as any standard Python module.
Instead of creating a new ReaScript containing:
from reaper_python import * RPR_ShowConsoleMsg("Hello world!")
you can open your usual Python shell and type:
>>> import reapy >>> reapy.print("Hello world!")
All ReaScript API functions are available in
reapy in the sub-module
reapy.reascript_api. Note that in ReaScript Python API, all function names start with
"RPR_". That unnecessary pseudo-namespace has been removed in
reapy. Thus, you shall call
reapy.reascript_api.GetCursorPosition in order to trigger
reaper_python.RPR_GetCursorPosition. See example below.
>>> from reapy import reascript_api as RPR >>> RPR.GetCursorPosition() 0.0 >>> RPR.SetEditCurPos(1, True, True) >>> RPR.GetCursorPosition() 1.0
Note that if you have the SWS extension installed, the additional ReaScript functions it provides will be available in
reapy.reascript_api and usable inside and outside REAPER as well.
The purpose of
reapy is to provide a more pythonic API as a substitute for ReaScript API. Below is the
reapy way of executing the example above.
>>> import reapy >>> project = reapy.Project() # Current project >>> project.cursor_position 0.0 >>> project.cursor_position = 1 >>> project.cursor_position 1.0
The translation table matches ReaScript functions with their
When used from inside REAPER,
reapy has almost identical performance than native ReaScript API. Yet when it is used from the outside, the performance is quite worse. More precisely, since external API calls are processed in a
defer loop inside REAPER, there can only be around 30 to 60 of them per second. In a time-critical context, you should make use of the
reapy.inside_reaper context manager.
>>> import reapy >>> project = reapy.Project() # Current project >>> # Unefficient (and useless) call >>> bpms = [project.bpm for _ in range(1000)] # Takes at least 30 seconds... >>> # Efficient call >>> with reapy.inside_reaper(): ... bpms = [project.bpm for _ in range(1000)] ... >>> # Takes only 0.1 second!
For now, about a half of ReaScript API has a
reapy counterpart, the docs are far from great, and many bugs are waiting to be found. Feel free to improve the project by checking the contribution guide!
RomÃ©o DesprÃ©s - RomeoDespres
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size python_reapy-0.4.3-py2.py3-none-any.whl (270.4 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size python-reapy-0.4.3.tar.gz (157.1 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for python_reapy-0.4.3-py2.py3-none-any.whl