W3C home > Mailing lists > Public > public-audio@w3.org > January to March 2012

Re: oscillators and the Web Audio API

From: Phil Burk <philburk@mobileer.com>
Date: Thu, 09 Feb 2012 09:59:41 -0800
Message-ID: <4F34098D.6000709@mobileer.com>
CC: public-audio@w3.org


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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 9 February 2012 18:00:18 GMT