npm

Need private packages and team management tools?Check out npm Orgs. »

asynth

0.1.1 • Public • Published

asynth

create midi synths with javascript functions

example

var asynth = require('asynth');
var s = asynth(function (note, t) {
    var freq = 440 * Math.pow(2, (note.key - 49) / 12);
    var x = Math.sin(2 * Math.PI * t * freq);
    var y = Math.sin(2 * Math.PI * t * (freq * 2));
    var z = Math.sin(2 * Math.PI * t * (freq / 2));
    return x * 0.6 + y * 0.2 + z * 0.2;
});
 
s.play();

Now plug in a USB keyboard and it will sound like an organ.

methods

var asynth = require('asynth')

var b = asynth(synth)

Create a new synth out of a synth(note, t) function.

note.key is the number of the key pressed on the synth.

There are some other properties like timestamps for up, down, and start events that you might also want to care about.

Return a baudio instance.

install

With npm do:

npm install asynth

license

MIT

Keywords

none

install

npm i asynth

Downloadsweekly downloads

3

version

0.1.1

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability