Skip to main content

reathon

reathon is a python package for constructing REAPER session with native python constructs. The majority of the interface is a reflection of the .rpp file structure which itself is very similar to .xml with tags and elements (except each element is called a 'chunk'). As such, you may need to know a bit about the underlying structure of REAPER's file format before using something like this. A good way to do this is to make a REAPER project and open the project in a text editor. You might also refer to this document which is fairly exhaustive.

installation

You can git clone this repo, cd to it and then install via pip install -e reathon. You need to point pip to the folder containing setup.py, not the parent folder with examples and README.md etc.

You can also pip install reathon.

usage

reathon exposes objects for each type of 'chunk' or as I've called it node in the graph of objects in a session. A very simple example of a REAPER project with a single track would go as follows.

from reathon.nodes import * # import all of the reathon nodes

project = Project( # create an instance of a project
    Track() # and pass a Track() object to the constructor
)

project.write("basic.rpp") # write the project out to the path

We can construct such graphs in a variety of ways which lends reathon towards programmatic constructions of projects.

# Using Loops
from reathon.nodes import *

project = Project() # create an instance of a project

for x in range(1024):
    project.add(Track()) # use the add method of the project to add a Track()

project.write("loops.rpp") # write the project out to the path
# Comprehensions
from reathon.nodes import *
tracks = [Track() for x in range(100)]
project = Project(*tracks)
project.write("comprehensions.rpp") # write the project out to the path

A more complex example might be to arrange a series of sound files randomly along a single track, similar to a granular synthesiser. This example presents new reathon nodes you won't have seen before

from reathon.nodes import Project, Track, Item, Source # note new nodes Item() and Source()
from pathlib import Path
import random

sources = []

# create a source object for each of the .wav files in a directory (can you tell I love comprehensions)
sources = [
    Source(file=f'{str(x)}')
    for x in Path('my-sounds').rglob("*.wav") # you would point it to an actual folder of sounds, not just 'my-sounds'
]

track = Track() # create a blank Track()

pos = 0.0 # set our initial position to 0
for x in range(1000): # 1000 grains
    grain = random.choice(sources) # random file from our sources
    
    length = random.uniform(0.1, 0.5) # random length of the item
    track.add(
        Item(
            grain, # Item()'s have a child Source() node, which is randomly selected above
            position = pos, # and we set the position
            length = length # and we set the length
        )
    )
    pos += length # increment the position by the length to create contiguous blocks

project = Project(track) # create the project with our composed track
project.write("granular.rpp") # write it out

props

In the .rpp structure each 'chunk' can have various properties. For example, the ITEM chunk will have length and position properties that determine where in the timeline the item is positioned and the duration of the item. I don't want to implement functions for each of these so there are ways to insert arbitrary properties for each 'chunk', or what you are now familiar with as a reathon 'node'.

# modifiying properties with function arguments
from reathon.nodes import *
item = Item(
    length = 10, 
    position = 0.5
) # create a blank item 10 seconds in length a 0.5 seconds in the timeline
# the convention is you match the word of the property as lower case.
# if the property in the file is LENGTH, then the function argument is 'length'
track = Track(item)
project = Project(track)
project.write("properties1.rpp") # write the project out to the path
# modifiying properties by directly modifying the .props of the object
from reathon.nodes import *
item = Item() # create a blank item 10 seconds in length a 0.5 seconds in the timeline
item.props = [
    ["LENGTH", 10],
    ["POSITION", 0.5]
]
track = Track(item)
project = Project(track)
project.write("properties1.rpp") # write the project out to the path

Metadata

Release files for reathon 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reathon 0.0.9
File Size Uploaded
reathon-0.0.9.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reathon 0.0.9
File Interpreter ABI Platform
reathon-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / reathon-0.0.9.tar.gz

Download URL reathon-0.0.9.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
45abcce5d17508440850ec291650c35d6670e3a20c4af4a8df910744f575327c
BLAKE2b-256 checksum
How to use checksums
d4a837b96f136a9c598122e71bf1fb83399116366682750505954cb0e04a774a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / reathon-0.0.9-py3-none-any.whl

Download URL reathon-0.0.9-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f55af3864d1f99edf27069245d3b494ca2ae60c92756f8a87e31c6a327bbb1b
BLAKE2b-256 checksum
How to use checksums
0d01f6113daeb534cbc4beec5cf63a5ac2b4da703c8d431cff63dd967df55a65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

1 release file

0.0.5

1 release file

0.0.4

2 release files

0.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page