rpp

Read and write Reaper RPP files with Python.


Keywords
parser, ply, python, python3, reaper
License
BSD-3-Clause
Install
pip install rpp==0.5

Documentation

RPP

RPP is a format used to describe REAPER projects. This package is designed to be an RPP parser/emitter and uses PLY as a parser framework.

Examples

Import the package:

>>> import rpp

Decode RPP:

>>> r = rpp.loads("""\
<REAPER_PROJECT 0.1 "4.32" 1372525904
  RIPPLE 0
  GROUPOVERRIDE 0 0 0
  AUTOXFADE 1
>
""")
>>> r
Element(tag='REAPER_PROJECT', attrib=['0.1', '4.32', '1372525904'], children=[
    ['RIPPLE', '0'],
    ['GROUPOVERRIDE', '0', '0', '0'],
    ['AUTOXFADE', '1'],
])

Transform elements into RPP:

>>> from rpp import Element
>>> rpp.dumps(
...     Element(tag='REAPER_PROJECT', attrib=['0.1', '4.32', '1372525904'], children=[
...         ['RIPPLE', '0'],
...         ['GROUPOVERRIDE', '0', '0', '0'],
...         ['AUTOXFADE', '1'],
...     ]))
'<REAPER_PROJECT 0.1 4.32 1372525904\n  RIPPLE 0\n  GROUPOVERRIDE 0 0 0\n  AUTOXFADE 1\n>\n'

Element mimics the interface of xml.etree.ElementTree.Element. You can perform querying operations with findall, find, iterfind. Note that attribute and text predicates are not supported.

>>> groupoverride = r.find('.//GROUPOVERRIDE')
>>> groupoverride
['GROUPOVERRIDE', '0', '0', '0']
>>> groupoverride[1:] = ['9', '9', '9']
>>> r
Element(tag='REAPER_PROJECT', attrib=['0.1', '4.32', '1372525904'], children=[
    ['RIPPLE', '0'],
    ['GROUPOVERRIDE', '9', '9', '9'],
    ['AUTOXFADE', '1'],
])

Dependencies