- From: Ray Bellis <ray@bellis.me.uk>
- Date: Sat, 21 Jul 2012 22:20:12 +0100
- To: public-audio@w3.org
On 21/07/2012 21:13, Peter van der Noord wrote: > Can anybody give a quick and short example of the creation of a > wavetable? I did some reading about wavetables, and as i understand > it, you can specify the harmonics for the wave-cycle, but i'm not sure > how it works and what the params do exactly If you set the cos wave to [0, 1] and the sin wave to [0, 0] you just get a pure sine wave. If you flipped those two around you still get a sine wave, but it's rotated 90' in phase. If the waves are [0, 0, 1] and [0, 0, 0] you get a sine wave at double the harmonic frequency. For each component "n" in the two tables the amplitude of the frequency (f * n) is proportional to sqrt(cos_table[n]^2 + sin_table[n]^2) The phase is atan2(sin_table[n], cos_table[n]) At least that's how I understand it :) Ray
Received on Saturday, 21 July 2012 21:20:36 UTC