npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rppp

v0.4.2

Published

Reaper .RPP Parser

Downloads

32

Readme

RPP Parser

Package for parsing and programmatically constructing files for the Reaper Digital Audio Workstation.

$ npm install rppp

Parsing

This library parses Reaper Files structured JavaScript objects.

This divides the contents of a Reaper file two structs and ReaperBase instances.

struct instances

A .RPP file contains, structs that look like this:

POSITION 2 1 4

When rppp.parse(rppFileString) encounters a struct while parsing a stringified .RPP file, it will convert it to a JavaScript Objects with a .token, ("POSITION"), and a list of .params, ([2, 1, 4]).

{ token: 'POSITION', params: [2, 1, 4] }

ReaperBase instances

.RPP files also have more complex data type that contain an ordered collection of content. In the .RPP file, these look like this:

<ITEM
  POSITION 2
  LENGTH 10.2
  <SOURCE WAVE
    FILE "filename"
  >
>

When rppp.parse encounters this data type it is parsed into ReaperBase class instances shown in example below. Note that that the .contents array main contains both structs and additional ReaperBase isntances:

new ReaperBase({
  token: "ITEM",
  params: [],
  contents: [
    { token: "POSITION", params: [2] },
    { token: "LENGTH", params: [10.2] },
    new ReaperBase({
      token: "SOURCE",
      params: ["WAVE"],
      contents: [{ token: "FILE", params: ["filename"] }],
    }),
  ],
});

ReaperBase instances have the following helper methods:

getOrCreateStructByToken(token, index); // Gets the index'th struct with a specified token and returns the object. If the `index`'th struct was not found, then create a token and push it to the end of the contents array.
add(obj); // Adds an object to the contents array of the current object.
dump(); // Dumps the current object into a string in the RPP format.

There are some additional helper methods for manipulating the speciffic Reaper object instances. The rppp.specialize() function recursively iterates over all contents of a ReaperBase instances, and returns a new JavaScript instances with additional helper methods for manipulating certain types of RPP data.

Currently, the specialize function supports the following prototypes:

ReaperProject; //PROJECT
ReaperTrack; //TRACK
ReaperNotes; //NOTES
ReaperMidiItem; //ITEM (MIDI)
ReaperAudioItem; //ITEM (AUDIO)
ReaperVst; //VST
ReaperFXChain; //FXCHAIN
ReaperVolumeAutomation; //VOLENV2
ReaperPanAutomation; //PANENV2
ReaperWidthAutomation; //WIDTHENV2
ReaperTempoTimeSigAutomation; //TEMPOENVEX

Example:

const rppp = require("rppp");
const base = rppp.parse(
  `<ITEM
  POSITION 2
  LENGTH 10.2
  <SOURCE WAVE
    FILE "filename"
  >
>`
);

const result = rppp.specialize(base);

const expect = new ReaperAudioItem({
  token: "ITEM",
  params: [],
  contents: [
    { token: "POSITION", params: [2] },
    { token: "LENGTH", params: [10.2] },
    new ReaperBase({
      token: "SOURCE",
      params: ["WAVE"],
      contents: [{ token: "FILE", params: ["filename"] }],
    }),
  ],
});

Constructing

This package also allows one to construct an RPP file from scratch using the specified prototypes.

Example:

This returns a string in the form of an RPP file which can be loaded into Reaper. It contains a track with the name 'hello'.

const rppp = require("rppp");

const project = new rppp.objects.ReaperProject();
project.addTrack(new rppp.objects.ReaperTrack()); // ReaperProject supports `addTrack`.
project.getOrCreateStructByToken("TRACK").add({
  token: "NAME",
  params: ["hello"],
});

console.log(project.dump());

Development

Recommended VS Code Plugin: PEG.js Language by Futago-za Ryuu

npm run gen # generate the parser and typescript definitions
npm run test