# [LAD] Wavetable synthesis : Creating fat wavetables

Fri Aug 24 22:48:56 UTC 2012

```On Fri, Aug 24, 2012 at 08:35:29PM +0000, harryhaaren at gmail.com wrote:

> My intention is indeed to do "waldorf style" cascaded wavetables
> which are interpolated between. I have a program that I can use to
> test the wavetables, but the issue of tuning remains a problem for
> me.

A few things to consider.

You need an interpolation method that doesn't create artefacts, in
this case aliasing. You'll also want it to be fast and efficient.
The easiest way in the case of wavetable synthesis is to upsample
your waves by a factor of say 8, then use linear interpolation.
Takes more memory, but memory is cheap these days. Aeolus does this
for pipes that contain significant energy above 1/8 of the sample
rate.

Provided you have a *good* interpolation method, two things follow.

* Your wavetable doesn't need exactly K cycles in N samples, K,N
integer. If for example you know you have an integer number of cycles
in say 123.4 samples, create a wavetable with 124 samples. On the first
iteration, use samples 0...123, then when you reach 124 (beyond the end
of the table), jump back 123.4 samples, so interpolate at 0.6, 1.6, 2.6
etc. Similar for all iterations through the loop, the third will be 0.2,
1.2, 2.2 etc.

* If you are prepared to e.g. turn a C into a C# by interpolation,
then you could as well interpolate to obtain the C. In other words,
the wavetable doesn't need to be exactly C in the first place. You
just need to know its exact pitch.

Picking loop entry/exit points by looking for zero crossings can
sometimes provide a reasonable result, but it's pure chance. First,
the zero crossings could be everywhere between the samples. Second,
the distance between two zero crossings doesn't need to be an exact
number of cycles.

The easiest way to obtain good loops of natural sounds is to have
a playback engine that works as described above, and that allows
you to modify the supposed lenght of the loop (the 123.4 in the
example) in real time while listening to the result. The alternative
is to compute the phase trajectory of the entire waveform, which will
tell you the exact pitch with much more precision than looking at the
waveform.

Whatever the method, the result could be that you have a discon-
tinuity between the start and end of the loop. There can be many
causes for that. With recorded samples LF noise is one, or the
harmonics could simply be not exactly harmonic. In such cases you
need to test a different start and end points, until you find some
that work well, or to 'bend' the waveform so the ends meet.

Ciao,

--
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)

```