# Re: Wavetable example?

From: Ray Bellis <ray@bellis.me.uk>
Date: Sun, 22 Jul 2012 19:17:06 +0100
Message-ID: <500C43A2.6050506@bellis.me.uk>
To: Peter van der Noord <peterdunord@gmail.com>

```On 22/07/2012 13:58, Peter van der Noord wrote:
> Hmmm, my math knowledge isnt of the level that i have an immediate idea
> about how that would work :)

OK, here's a more concrete example.

A square wave is defined as a series of the *odd* harmonics where the
contribution of each harmonic is inversely proportional to its harmonic
number.

So the second, fourth, etc harmonics are all *zero*.

The third harmonic is 1/3 the amplitude of the fundamental, and the
fifth is 1/5, etc.

See http://en.wikipedia.org/wiki/Square_wave

So the input "cos" table would just look like:

[ 0, 1, 0, 1/3, 0, 1/5, 0, 1/7, 0, 1/9, ... ]

The sin table for a square wave doesn't need any values because the
harmonics are all in phase.  So just use all zeroes.

Ray
```
Received on Sunday, 22 July 2012 18:17:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:01 UTC