Using phasor to count
var audio = new maximJs.maxiAudio(); audio.init(); var myCounter = new maximJs.maxiOsc(); //these oscillators will help us count and play sound var mySquare = new maximJs.maxiOsc(); //we're going to put the current count in this variable so that we can use it more easily. var currentCount; audio.play = function(){ CurrentCount = Math.floor(myCounter.phasor(1, 1, 9));//phasor can take three arguments; frequency, start value and end value output=mySquare.square(CurrentCount*100); }