synthdef-decoder
decoder for SuperCollider Synth Definition File Format
Installation
npm install synthdef-decoder
API
decode(buffer: ArrayBuffer): Object[]
Example
SynthDef("sine", { |amp = 0.5, freq = 440| Out.ar(0, SinOsc.ar(freq, 0, amp) ! 2);}, variants:(alpha:[amp:0.25,freq:880], beta:[freq:1760]))
const fs = ;const decoder = ; const file = fs;const buffer = filebuffer;const json = decoder; console;
// the name of the synth definition "name": "sine" // constant values "consts": 0 // initial parameter values "paramValues": 05 440 // param-name // { key: the name of the parameter, value: its index and length in the parameter array } "paramIndices": "amp": index: 0 length: 1 "freq": index: 1 length: 1 // ugen-spec // [ [ // the name of the SC unit generator class, // calculation rate (0: Scalar, 1: Control, 2: Audio), // special index, // input-spec, // [ [ index of unit generator, index of unit generator output ] // or [ -1 for a constant, index of constant ] ] // output-spec // [ calculation rate ] // ] ] "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 // variant-spec // { key: the name of the variant, value: variant initial parameter values } "variants": "alpha": 025 880 "beta" : 05 1760
License
MIT