## Help me learn the mathematical formulas behind wavetables

kryptonaut
KVRian

713 posts since 25 Apr, 2011

by kryptonaut; Fri Mar 02, 2018 3:24 am Re: Help me learn the mathematical formulas behind wavetables

mystran wrote:
kryptonaut wrote:For generating bandlimited sounds with 'stretched' (or compressed) harmonics, you can experiment with the formula given on the first page of http://www.jamminpower.com/PDF/Sine%20Summation.pdf - these waves can't be put in a wavetable as they aren't periodic, but they can generate some interesting sounds.

I know this thread is a bit old by now, but you can put these into wavetables --- or rather, you can play any wavetable with stretched or compressed harmonics. It's actually fairly simple (and only slightly more expensive computationally when compared to regular wavetable playback):

Yes, pitch-shifting plus frequency-shifting is another interesting way to make sounds with stretched partials. I hadn't considered doing that with a pre-calculated complex wavetable, that's a nice technique.

My original post was more to draw attention to the sine-series-summation formulae (derived similar to the Dirichlet kernel) that allow you to easily calculate a perfectly bandlimited sum of partials, which can be harmonic or stretched/compressed, and can also be given an exponential decay so that higher frequencies are rolled off or emphasised. Combining two or more of these can give more interesting partial profiles (e.g. notches or peaks), with scope for modulation as well.

It's an interesting synthesis technique to explore, anyway.
matt42
KVRian

1044 posts since 9 Jan, 2006
It's a nice paper I was just playing around graphing the functions and might test it out in a synth. I'm not much of a mathematician, but it'd be nice to have similar summation formulas that would allow partial roll off of 1/n rather than a^n to allow warping of traditional synth wave shapes. But, then I guess mystrans idea of a complex table would work well for that.
mystran
KVRAF

4979 posts since 11 Feb, 2006, from Helsinki, Finland
kryptonaut wrote:My original post was more to draw attention to the sine-series-summation formulae (derived similar to the Dirichlet kernel) that allow you to easily calculate a perfectly bandlimited sum of partials, which can be harmonic or stretched/compressed, and can also be given an exponential decay so that higher frequencies are rolled off or emphasised.

Sure. The main "gotcha" to keep in mind with DSF-style synthesis is that you need to cross-fade between multiple versions when modulating the pitch (unless you want to allow aliasing in this case), since simply changing the limit of the summation results in clicking harmonics (most obviously a problem at higher frequencies), but this is not a huge deal if you're using a modulation rate that's low enough that cross-fading from one modulation frame to the next is smooth enough (eg. at 44.1kHz you can probably get away with 16 samples mod rate without overlapping the cross-fades) and the technique doesn't really work too well with fast modulation anyway (since the band-limiting is only correct for fixed pitch).
<- plugins | forum
mystran
KVRAF

4979 posts since 11 Feb, 2006, from Helsinki, Finland
matt42 wrote:It's a nice paper I was just playing around graphing the functions and might test it out in a synth. I'm not much of a mathematician, but it'd be nice to have similar summation formulas that would allow partial roll off of 1/n rather than a^n to allow warping of traditional synth wave shapes. But, then I guess mystrans idea of a complex table would work well for that.

Historically BLIT (=DSF with flat spectrum) was sometimes used for band-limited waveform generation, but this technique has two problems: it doesn't behave too well under modulation (harmonics click if you change the limit and the band-limiting is no longer correct under modulation) and the post-integration for (1/f)^n spectrum accumulates errors (both numerical and the analytic errors from modulation).

The traditional solution to the modulation problem is BLIT-SWS which precalculates a single pulse (eg. as a windowed polyphase kernel) and then composites them at run-time. The pitch then is the result of the comb-filtering. The traditional solution to the integration problem is to take BLIT-SWS and move the integration into the pre-calculation stage and treat the DC components analytically... which gets us the modern BLEP technique.

While in retrospective you can arrive at BLEP from other angles as well, historically it is the result of two separate "fixes" to BLIT, which is nothing more than a restricted version of DSF.
<- plugins | forum
AnalogGuy1
KVRian

547 posts since 5 Mar, 2005, from USA

by AnalogGuy1; Fri Mar 02, 2018 6:36 am Re: Help me learn the mathematical formulas behind wavetables

kamalmanzukie wrote:i was looking at google trends the other day, all the time series data. a lot of them are clearly periodic and i have wondered how some of them might sound as a wavetable.

the thing that i really can't get my head around though, is a lot of these google 'waveforms' clearly have a good bit of harmonic content. i mean, its one thing to have a year long periodicity for the word 'flowers', but what about the overtones?

i can't conceptualize it without getting a bit metaphysical. of course, i've played around in a spectrogram, loop a column of noise burst and it becomes rows of harmonics, but even that still kind of mystifies me

Right, if you take a signal like x[n], and loop in the time domain to create y[n] = [ x[n] x[n] x[n] x[n] ...], then that is the same thing as convolving x[n] with a train of impulses that are each separated by the length of x[n] = N. You are interested in frequency domain behavior. Time domain -> frequency domain as convolution -> multiplication, and impulse train separated by N -> impulse train separated by f=1/N (and a simple amplitude scaling not bearing on your question). The frequency separation of the impulses will be the same as the frequency separation of each of your DTFT samples in your original short x[n] (also separated by f=1/N), so looping will give the same general shape in the frequency spectrum but with sharp impulsive peaks separated by zero-valued valleys, with each valley about as wide in frequency as 1/(length of your original x[n] sequence).

I'm not sure if that scratches the itch of your question, but if it does, I recommend first reading about how periodic signals can be analyzed in terms of a Fourier Series, and then learning about how this process can be extended into the Fourier Transform.
mystran
KVRAF

4979 posts since 11 Feb, 2006, from Helsinki, Finland
Anyway... for those wondering how harmonic stretching sounds, here's a quick prototype example using the proposed wavetable scheme. The actual "wavetable" is just some generated comb filtering and this prototype doesn't even have any envelopes or filters whatsoever, but.. you get the idea:

http://www.signaldust.com/files/hstretching.wav

The very beginning is without any stretch. There's a hint of reverb, but no other effects, so all the beating (or chorusing?) is a result of the stretch.

I kept things roughly in the realm of musical, but it's obviously possible to stretch way more as well.
<- plugins | forum
matt42
KVRian

1044 posts since 9 Jan, 2006
Thanks Mystran. It's a long time since I looked up BLIT methods and I've never implemented it. You're right, of course that unity DSF generates a bipolar BLIT.

Is the modulation problem with DSF simply the click when harmonics are suddenly added, or does the method just not behave well when modulated in general?
Previous

Moderator: KVR Moderators (Main)