# Interpolating between multiple waves in a wavetable oscillator?

**URL:** https://forum.juce.com/t/interpolating-between-multiple-waves-in-a-wavetable-oscillator/45385
**Category:** General JUCE discussion
**Created:** [April 7, 2021, 12:10am UTC](https://forum.juce.com/t/interpolating-between-multiple-waves-in-a-wavetable-oscillator/45385 "2021-04-07T00:10:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hsetlik](https://avatars.discourse-cdn.com/v4/letter/h/85f322/32.png) [@hsetlik](https://forum.juce.com/u/hsetlik)
#### Post date: [April 7, 2021, 12:10am UTC](https://forum.juce.com/t/interpolating-between-multiple-waves-in-a-wavetable-oscillator/45385/1 "2021-04-07T00:10:18Z")

</div>

I’ve set up a synth plugin where each oscillator contains a set of multiple waves loaded from an audio file, each wave then gets a band-limited set of subtables as described by Nigel Redmon [here](https://www.earlevel.com/main/2012/05/08/a-wavetable-oscillator%E2%80%94part-2/). All that works as expected with a single wave (or ‘frame’), but sweeping the position across multiple frames generates a lot of noise and irregularities. Right now, I’m basically trying to just lerp between two adjacent frames and the code looks like this:

```auto
        pFrame = position * (numFrames - 1);
        lowerIndex = floor(pFrame);
        skew = pFrame - lowerIndex;
        upperIndex = (lowerIndex == (numFrames - 1)) ? 0 : lowerIndex + 1;
        bSample = aFrames[lowerIndex].getSample(freq);
        tSample = aFrames[upperIndex].getSample(freq);
        output = bSample + ((tSample - bSample) * skew);

```

Considering that the band-limiting works fine on single frames at all octaves, it seems like the issue has to be in the interpolation between adjacent frames but I can’t guess why the above code yields such bad sound. Any insight from those who have implemented this sort of thing before is much appreciated.
