Counting

Using phasor to count

        var mySine = new maximJs.maxiOsc(); // This is the oscillator we will use to generate the test tone
        var myClock = new maximJs.maxiClock(); // This will allow us to generate a clock signal and do things at specific times
        var freq; // This is a variable that we will use to hold and set the current frequency of the oscillator


        function setup(){  
        myClock.setTicksPerBeat(1);//This sets the number of ticks per beat
        myClock.setTempo(120);// This sets the tempo in Beats Per Minute
        freq=20; // Here we initialise the variable
    }


    function play(){
    myClock.ticker(); // This makes the clock object count at the current samplerate
    
    //This is a 'conditional'. It does a test and then does something if the test is true 
    // console.log(myClock.isTick());
    if (myClock.tick) { // If there is an actual tick at this time, this will be true.
    freq+=100; // DO SOMETHING
    
} // The curly braces close the conditional

output=mySine.sinewave(freq);//simple as that!

}