
Background audio processing using AudioWorklet.Controlling multiple parameters with ConstantSourceNode.Example and tutorial: Simple synth keyboard.We're going to be looking at a very simple step sequencer: In practice, this is easier to do with a library - the Web Audio API was built to be built upon. If you are about to embark on building something more complex, tone.js would be an excellent place to start.
Chrome add on lab scheduler how to#
However, we want to demonstrate how to create such a demo from first principles as a learning exercise. The interface consists of master controls, which allow us to play/stop the sequencer, and adjust the BPM (beats per minute) to speed up or slow down the "music".įour different sounds, or voices, can be played.

Each voice has four buttons, one for each beat in one bar of music. When they are enabled, the note will sound. The methods we are using are: Name of voice When the instrument plays, it will move across this set of beats and loop the bar.Įach voice also has local controls, allowing you to manipulate the effects or parameters particular to each technique we use to create those voices.

Js const notesInQueue = function scheduleNote ( beatNumber, time )

Here we look at the current time and compare it to the time for the following note when the two match, it will call the previous two functions.ĪudioContext object instances have a currentTime property, which allows us to retrieve the number of seconds after we first created the context. We will use it for timing within our step sequencer.
