Wednesday 23 September 2015

Updated Web API Causes problems

The last few days I have been trying a few examples of web audio  api and have had a few problems implementing some of the features.
For example, when we create a new oscillator we can set the waveform type to:

  • Sine
  • Square
  • Sawtooth
  • Triangle 
So the old way to set the waveform type was using a number to represent the type or the name of the waveform:

oscillator1.type = 0; // for a sine wave
oscillator2.type = square;


A search on the error message I received led me to the updated syntax for the api:

oscillator2.type = "square";

So from this I have learnt to always check the dates of tutorials and have the web standards site open for reference.

No comments:

Post a Comment