# [LAD] Wavetable synthesis : Creating fat wavetables

Devin Anderson surfacepatterns at gmail.com
Fri Aug 24 21:05:27 UTC 2012

```On Fri, Aug 24, 2012 at 1:35 PM,  <harryhaaren at gmail.com> wrote:

> Example:
> I record a C3 note, 10 seconds of it. Then I want to create a wavetable.
> Search for a zero crossing after 1 second, chop. Looped playback = C3.
> Now I want to have a C#3, so 1/12 of the double of the frequency, playing
> back at that rate will NOT always provide a C#3.
>
> Why? The sample is the wrong length. The "fundamental" of the note is not
> perfectly looped, not even all the harmonics are. Hence you "feel" a wrong
> pitch. Its a bit of a wierd problem.

I've been thinking about a similar problem.  I'd like to teach
`synthclone` how to detect and/or create basic loops.

I haven't gotten around to it yet, but the way I am currently thinking
of approaching the problem is as follows:

1.) Have the user determine a *safe* start point and end point in the
sample where looped data might be created.  This shouldn't include any
attack or release samples.  Ideally, when a sample volume is
controlled with an ADSR envelope or such, this is where the sustain
starts and ends.
2.) Determine the general pitch of the sample.
3.) Find the largest region possible between the start and end points
that contains N cycles of data (determined by the pitch), where N
approximates a positive even integer as closely as possible.
4.) Divide the region (from 3 above) into two equal parts (A and B).
5.) Substitute B with a crossfade (C) from B to A.
6.) Make your loop points the start and end of your new region (C).

This might be total BS, as I haven't done a lot of research on the
problem, and I know very little about DSP.  Feel free to flame me if
you know what you're talking about and I'm way off-base, though I'd
much prefer pointers to documentation on how to do this correctly. :)

--
Devin Anderson
surfacepatterns (at) gmail (dot) com

blog - http://surfacepatterns.blogspot.com/