Shift+Ctrl+J on the keyboard.
The first thing we have to do is to define a
context by typing:
var context = new AudioContext()
We can think of "context" as the virtual area within which we will create the sound.
Then, we have to create a sound source. In this example we are going to create an oscillator:
var oscillator = context.createOscillator()
An oscillator is a repeating waveform with a fundamental frequency and peak amplitude and it forms the basis of most popular synthesis techniques today. (source: wikibooks, "Sound Synthesis Theory"
Finally we should connect the sound source to the "destination" output, usually our computer's speakers.
And fire it up with (please, take off your headphones!):
oscillator.stop(0) to stop it.
Voila! We have created a creaming browser!
It is really amazing what we can do with the Web Audio API. I highly recommend you to watch a rocking presentation by Stuart Memo to get inspired and learn more about it.
I am sure that there are far too many ways that museums could use Web Audio API to create on-site and online applications. Probably the most obvious are:
1. apps to explain soundwaves
2. musical instruments
3. sound mashup and mixes
I will try to explore few of these possibilities further and share code and experience in future posts. In the meantime, if you have an idea of a project please, do not hesitate to contact me! Let's do it together!