UNPKG

gibberish-dsp

Version:

Gibberish is designed to be an optimized API for audio synthesis using per-sample techniques.

27 lines (16 loc) 645 B
const ugen = require( '../ugen.js' ), g = require( 'genish.js' ) module.exports = function( Gibberish ) { const AD = function( argumentProps ) { const ad = Object.create( ugen ), attack = g.in( 'attack' ), decay = g.in( 'decay' ) const props = Object.assign( {}, AD.defaults, argumentProps ) const graph = g.ad( attack, decay, { shape:props.shape, alpha:props.alpha }) ad.trigger = graph.trigger const __out = Gibberish.factory( ad, graph, ['envelopes','AD'], props ) return __out } AD.defaults = { attack:44100, decay:44100, shape:'exponential', alpha:5 } return AD }