No description, website, or topics provided.
JavaScript
Latest commit b3039d7 Aug 23, 2016 @mohayonao 0.0.23
Permalink
Failed to load latest commit information.
src refine synth unit #1 Aug 23, 2016
test refine synth unit #1 Aug 23, 2016
.babelrc update dev tools Jul 13, 2016
.eslintrc up dev tools Jul 11, 2016
.gitignore init Jul 10, 2016
.travis.yml update dev tools Jul 10, 2016
README.md update README [ci skip] Jul 18, 2016
package.json 0.0.23 Aug 23, 2016

README.md

scsynth

Build Status NPM Version License

sound processing like SuperCollider in JavaScript

👷 💤

Installation

npm install --save scsynth

Example

const scsynth = require("scsynth");

const context = new scsynth.SCContext();
const synth = context.createSynth({
  name: "sine",
  consts: [ 0 ],
  paramValues: [ 0.5, 440 ],
  paramIndices: { amp: { index: 0, length: 1 }, 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 ] ], [      ] ]
  ]
});

context.append(synth);

for (let i = 0; i < 256; i++) {
  synth.$freq = 440 * Math.pow(2, i / 256);
  synth.$amp = 1 - (i / 256);
  synth.process();

  console.log("L:", context.outputs[0]);
  console.log("R:", context.outputs[1]);
}

See Also

License

MIT