Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Usage error #3

Open
jnccneto opened this issue Aug 13, 2015 · 0 comments
Open

Simple Usage error #3

jnccneto opened this issue Aug 13, 2015 · 0 comments

Comments

@jnccneto
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant