pd-fileutils

A set of utilities for Pure Data files : parser, image generator.

npm install pd-fileutils
12 downloads in the last month

Pure Data file utilities

Build Status

This library is a set of tools for handling pure data files.

pd-fileutils allows you to parse Pd files to a JavaScript object which is easy to modify. Of course, you can also create a patch from scratch. A patch can then be rendered to pd format, or to SVG if you want an image of it.

Demos

  • Online SVG renderer : post your patch to gist, and then replace gist ID in the url to render it. You can then share that link with your Pd friends.
  • Random drone generator : generate random droning patches (you know ... robot sounds), listen to them online, and download the pd file if you like it.

Usage in the browser

First download the latest browser build from dist/.

You will also need d3 (for svg rendering), mustache (for pd file rendering) and underscore.

Include them in your page along with pd-fileutils :

  <script src="js/d3.v3.min.js"></script>
  <script src="js/underscore-min.js"></script>
  <script src="js/mustache.js"></script>
  <script>var mustache = Mustache</script>
  <script src="js/pd-fileutils.js"></script>

Then you can use pd-fileutils in your webpage :

<div id="svg"></div>
<script>
    var patch = pdfu.parse('#N canvas 778 17 450 300 10;\n#X obj 14 13 loadbang;\n#X obj 14 34 print bla;\n#X connect 0 0 1 0;')
    var rendered = pdfu.renderSvg(patch, {svgFile: false})
    $('#svg').html(rendered)
</script>

The complete example can be found here.

Usage on node.js

Installation

Obviously, you will need node.js.

Installation is easier with the node package manager npm :

npm install pd-fileutils

To install the command-line tool globally, you might want to run npm with the -g option. Note that in this case you might need admin rights :

npm install -g pd-fileutils

Command-line tool

At the moment, the only thing you can do is render .pd files to .svg, for example :

pd-fileutils myPatch.pd > myPatch.svg

History

0.3

  • parsing separates layout from model data
  • SVG rendering of all controls
  • basic pd rendering

0.2

  • SVG rendering + command-line tool
  • parsing supports most of the format

0.1

  • basic parsing
npm loves you