-
Notifications
You must be signed in to change notification settings - Fork 58
Tutorials: Getting Started
jussi-kalliokoski edited this page Sep 8, 2011
·
4 revisions
In this tutorial, we're going to go do something very basic: create a sine oscillator at 440Hz.
So, in order to create a sine tone, we'll have to create an AudioDevice instance for output and an Oscillator instance for the tone. This is how it happens:
var dev, osc;
function audioCallback(buffer, channelCount){
// Fill the buffer with the oscillator output.
osc.append(buffer, channelCount);
}
window.addEventListener('load', function(){
// Create an instance of the AudioDevice class
dev = audioLib.AudioDevice(audioCallback /* callback for the buffer fills */, 2 /* channelCount */);
// Create an instance of the Oscillator class
osc = audioLib.Oscillator(dev.sampleRate /* sampleRate */, 440 /* frequency */);
}, true);
Back to Tutorials