synthdef-json-formatter
v1.0.0
Published
formatter for SuperCollider Synth Definition File Format
Downloads
7
Readme
synthdef-json-formatter
formatter for SuperCollider Synth Definition File Format
Installation
npm install synthdef-json-formatter
API
format(json: object): string
Example
const formatter = require("synthdef-json-formatter");
const synthdef = {
"name":"sine",
"consts":[0],
"paramValues":[0.5,440],
"paramIndices":[{"name":"amp","index":0,"length":1},{"name":"freq","index":1,"length":1}],
"units":[["Control",1,0,[],[1,1]],["SinOsc",2,0,[[0,1],[-1,0]],[2]],["BinaryOpUGen",2,2,[[1,0],[0,0]],[2]],["Out",2,0,[[-1,0],[2,0],[2,0]],[]]],
"variants":[{"name":"alpha","values":[0.25,880]},{"name":"beta","values":[0.5,1760]}]
};
console.log(formatter.format(synthdef));
{
"name": "sine",
"consts": [ 0 ],
"paramValues": [ 0.5, 440 ],
"paramIndices": [
{ "name": "amp" , "index": 0, "length": 1 },
{ "name": "freq", "index": 1, "length": 1 }
],
"units": [
[ "Control" , 1, 0, [ ], [ 1, 1 ] ],
[ "SinOsc" , 2, 0, [ [ 0, 1 ], [ -1, 0 ] ], [ 2 ] ],
[ "BinaryOpUGen", 2, 2, [ [ 1, 0 ], [ 0, 0 ] ], [ 2 ] ],
[ "Out" , 2, 0, [ [ -1, 0 ], [ 2, 0 ], [ 2, 0 ] ], [ ] ]
],
"variants": [
{ "name": "alpha", "values": [ 0.25, 880 ] },
{ "name": "beta" , "values": [ 0.5, 1760 ] }
]
}
License
MIT