Re: oscillators and the Web Audio API

On 2/9/12 1:44 AM, Jussi Kalliokoski wrote:
> Store the oscillator's real phase (0.0 - 1.0) as a private variable,
> then use a modified version of that as the phase variable for the
> waveforms. Let p = phase, r = real phase, w = pulse width (0.0 - 1.0,
> default to 0.5 for unaltered waveforms)
>
> p = r < w ? r / w : (r-w) / (1-w)

Interesting. This is a kind of phase warping. The modified phase wraps 
twice causing the waveform to repeat. So there is a frequency doubling 
at w=0.5. The two repetitions of the waveform are faster then slower if 
w<0.5, or slower then faster if w>0.5.

Phil Burk

Received on Thursday, 9 February 2012 18:00:16 UTC