Using P5.js Audio with Hype

Hi I'm using p5.js and the audio library with Hype. I'm trying to do something very simple and I've gone though all of the examples but I'm still having trouble.

I have an element in hype and upon click I'd like play a note. Currently it works with this:

// create oscillator
var osc;
osc = new p5.TriOsc();
osc.start();
osc.amp(.5);
osc.freq(500);

// stop after .2 seconds
window.setTimeout(function () { osc.stop(); }, 200);

I'd like to be able to hook in an envelope so that the note has a more musical attack, sustain, decay etc.

Thank you in advance! Matt

Tagged:
Sign In or Register to comment.