Skip to content

Instantly share code, notes, and snippets.

@Simon-L
Last active March 6, 2017 11:04
Show Gist options
  • Select an option

  • Save Simon-L/d8280b58d1b671e2ce90c48f88dfdb88 to your computer and use it in GitHub Desktop.

Select an option

Save Simon-L/d8280b58d1b671e2ce90c48f88dfdb88 to your computer and use it in GitHub Desktop.
What are the pd objects supported by Heavy right now...? And is that patch supported?!
const fs = require('fs')
var $ = require('cheerio')
var request = require('request')
var pdfu = require('pd-fileutils')
var file_pd = fs.readFileSync(process.argv[2]).toString()
var nodes = pdfu.parse(file_pd).nodes
function gotHTML(err, resp, html) {
if (err) return console.error(err)
var parsedHTML = $.load(html)
var objects = []
parsedHTML('tbody tr td').map(function(i, object) {
objects.push(object.children[0].data)
})
objects.push("text", "msg")
console.log("As of right now, Heavy supports these objects:", objects.join(", "), "\n")
var uncompatibleNodes = []
nodes.forEach(function inspectNodes(node, i, a) {
if (!objects.includes(node.proto)) {
uncompatibleNodes.push(node)
console.error("\x1b[31m%s\x1b[0m %s", node.proto, " is either an abstraction or an object that is not supported. (" + node.proto + node.args.join(' ') + ")")
}
if ((node.subpatch !== undefined)) {
node.subpatch.nodes.forEach(inspectNodes)
}
})
console.log("\x1b[31m%s\x1b[0m %s", "\nAbstractions or uncompatible objects: ", uncompatibleNodes.map((n) => {return n.proto}).join(", "))
}
var domain = 'https://enzienaudio.com/docs/pdobjects.html'
request(domain, gotHTML)
{
"name": "heavypdobjects",
"version": "0.0.1",
"description": "What are the pd objects supported by Heavy right now...?",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"cheerio": "^0.22.0",
"pd-fileutils": "git+https://github.com/Simon-L/pd-fileutils.git",
"pd-fileutils.parser": "git+https://github.com/Simon-L/pd-fileutils.parser.git",
"request": "^2.79.0"
}
}
@Simon-L
Copy link
Copy Markdown
Author

Simon-L commented Feb 25, 2017

Rev1
Example output of just now:

$ node index.js 
As of right now, Heavy supports these objects:
["!=","%","&","&&","*","+","-","/","<","<<","<=","==",">",">=",">>","abs","atan","atan2","b","bang","bendin","bendout",
"bng","change","clip","cnv","cos","ctlin","ctlout","dbtopow","dbtorms","declare","del","delay","div","exp","f","float",
"floatatom","ftom","hradio","hsl","i","inlet","int","line","loadbang","log","max","metro","min","mod","moses","mtof",
"nbx","notein","noteout","outlet","pack","pgmin","pgmout","pipe","poly","pow","powtodb","print","r","random","receive",
"rmstodb","route","s","sel","select","send","sin","spigot","sqrt","swap","symbol","symbolatom","t","table","tabread",
"tabwrite","tan","tgl","timer","touchin","touchout","trigger","unpack","until","vradio","vsl","wrap","|","||","*~",
"+~","-~","/~","abs~","adc~","biquad~","bp~","catch~","clip~","cos~","cpole~","czero_rev~","czero~","dac~","dbtopow~",
"dbtorms~","delread~","delwrite~","env~","hip~","inlet~","line~","lop~","max~","min~","mtof~","noise~","osc~",
"outlet~","phasor~","pow~","q8_rsqrt~","q8_sqrt~","receive~","rpole~","rsqrt~","rzero_rev~","rzero~","r~","samphold~",
"samplerate~","send~","sig~","snapshot~","sqrt~","s~","tabosc4~","tabread4~","tabread~","tabwrite~","throw~",
"vcf~","vd~","wrap~"]

Rev2

$ node index.js ~/patches/fm1/_main.pd 
As of right now, Heavy supports these objects: !=, %, &, &&, *, +, -, /, <, <<, <=, ==, >, >=, >>, abs, atan, atan2, b, bang, bendin, bendout, bng, change, clip, cnv, cos, ctlin, ctlout, dbtopow, dbtorms, declare, del, delay, div, exp, f, float, floatatom, ftom, hradio, hsl, i, inlet, int, line, loadbang, log, max, metro, min, mod, moses, mtof, nbx, notein, noteout, outlet, pack, pgmin, pgmout, pipe, poly, pow, powtodb, print, r, random, receive, rmstodb, route, s, sel, select, send, sin, spigot, sqrt, swap, symbol, symbolatom, t, table, tabread, tabwrite, tan, tgl, timer, touchin, touchout, trigger, unpack, until, vradio, vsl, wrap, |, ||, *~, +~, -~, /~, abs~, adc~, biquad~, bp~, catch~, clip~, cos~, cpole~, czero_rev~, czero~, dac~, dbtopow~, dbtorms~, delread~, delwrite~, env~, hip~, inlet~, line~, lop~, max~, min~, mtof~, noise~, osc~, outlet~, phasor~, pow~, q8_rsqrt~, q8_sqrt~, receive~, rpole~, rsqrt~, rzero_rev~, rzero~, r~, samphold~, samplerate~, send~, sig~, snapshot~, sqrt~, s~, tabosc4~, tabread4~, tabread~, tabwrite~, throw~, vcf~, vd~, wrap~, text, msg 

hv.filter  is either an abstraction or an object that is not supported. (hv.filter lowpass 1000 2)
fft~  is either an abstraction or an object that is not supported. (fft~ yeah I know)

Abstractions or uncompatible objects:  hv.filter, fft~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment