tario / music.js

Music.js, status: Proof of Concept

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement audio param modulation

tario opened this issue · comments

For example, you can modulate the frequency or detune of an oscillator with another periodic wave to generate a vibrato effect. Or you can modulate a gain node to generate ADSR effect

Example:

// create the sound generator
var soundGenerator = {
  freq: function(fr) {
    var osc = music.oscillator({type: 'square', detune: MUSIC.modulator(function(p) {
      return p.gain(50).oscillator({type: "sine", frequency: 1.0});
    }));
  }
};

// add instrument to show on UI
return new MUSIC.Instrument(soundGenerator);