synthjs icon indicating copy to clipboard operation
synthjs copied to clipboard

Simple Usage error

Open jnccneto opened this issue 9 years ago • 0 comments

Hi

I am just trying the simple example but getting in errors:

    <script src="js/synth.js"></script>

var context = new AudioContext();

//square wave at 440 Hz (default) var osc = context.createOscillator(); osc.type = osc.SQUARE;

//envelope with 0.001 sec attack and 0.5 sec decay var envelope = context.createEnvelope(0.001, 0.5, 0, 0);

//feedback delay of 0.4 seconds with 0.5x feedback var feedbackDelay = context.createFeedbackDelay(0.4, 0.5);

osc.connect(envelope); envelope.connect(feedbackDelay); envelope.connect(context.destination); feedbackDelay.connect(context.destination);

//trigger the note and release after 0.6 seconds envelope.trigger(0.6);

The provided value 'undefined' is not a valid enum value of type OscillatorType. Synth.html:16 Uncaught TypeError: context.createEnvelope is not a function

Seems AudioContext is not being passed along Something I am missing here?

jnccneto avatar Aug 13 '15 09:08 jnccneto