# Re: [music-dsp] Wavetable File Formats?

```Below is my interpretation of the cool partial-shifting method Robert has
proposed.  (I'm just trying to understand, no claim to originality.)```
```
As far as I understand it, the method obtains, from a harmonic waveform, a
family of new waveforms where the partials are selectively pitch-shifted,
but remain harmonic.  It doesn't smoothly vary the pitch thru inharmonic
frequencies.

*Basic sonic waveform* to be manipulated:  a finite, weighted,* harmonic*
sum of k sinusoids, which for simplicity I'll assume all cross 0 at time
0.  So, the 1-periodic waveform

F(t)  =  Sum over i = 1, ..., k:    a_i * sin( w_i  t)

where each w_i is a positive integer mult. of 2 pi.  (We'll see where this
gets used.)

*Desired:* a way to selectively shift some of the harmonics
of our waveform.  Let q_1, ..., q_k be "shift-susceptibility" parameters
for the k harmonics; each may be positive, negative, or zero, but they need
to be integer multiples of 2 * pi.

*2-D Wavetable:* store for "all"  pairs (t, y) in the unit square [0, 1]^2,
the
value

G(t, y) =   Sum over i = 1, ..., k:    a_i * sin( w_i * t + q_i * y )

Ignoring time- and value-quantization issues here, as well as
y-quantization.

(Observe that for fixed y-value, the waveform over t is just a selectively
phase-shifted version of F.)

*Parameter to choose:*  an *integer* value c giving overall pitch-shift
amount desired.

(One could have more tuning parameters at the cost of a higher-dimensional
table G.)

*Synthesis lookup rule:  *at time T > 0  (a real value) the digital
oscillator outputs the value

Val(T) = G(T mod 1,  (cT) mod 1)

which, we note, equals

=   Sum over i = 1, ..., k:    a_i * sin(w_i * (T mod 1)   +   q_i * (cT
mod 1))

=   Sum over i = 1, ..., k:    a_i * sin((w_i + c * q_i) * T)

---the last equality using the fact that w_i and c*q_i are both integer
mults of 2 *pi.

...so that, under this setting to c, the i'th partial has been
frequency-shifted by an amount c*q_i from its original frequency, w_i.

On Tue, Mar 13, 2018 at 11:05 AM, Risto Holopainen <ebel...@ristoid.net>
wrote:

>
> > imagine it's two-dimensional vector synthesis like a Prophet VS.  one
> > dimension is some other timbre parameter with a minimum and a maximum
> > (no wrap around).
> >
> > so, in the other dimension, imagine having say, 6 identical wavetables
> > except the 2nd harmonic is offset by 60 degrees in phase between
> > adjacent wavetable vector points in that dimension.  all other
> > harmonics are exactly the same.  so as you crossfade from wavetable 0
> > to 1, that 2nd harmonic advances 60 degrees, as you crossfade from
> > wavetable 1 to 2, the 2nd harmonic advances another 60 degrees.
> > wavetable 6 and wavetable 0 are exactly the same.  as you crossfade
> > from wavetable 5 to 6 you're advancing the final 60 degrees back to
> > the original phase of wavetable 0.
> >
> That makes sense, I'll have to try it. Six wavetables for the detuned
> partial seems like a good number, and I can see that you would not want
> too few of them. But what's the reasoning behind how many to use?
>
> > now, if all of the other harmonics remain the same phase for all 6
> > wavetables, moving around between them does not detune those
> > harmonics.  but if you go around that circle (in the positive
> > direction) one complete loop, the 2nd harmonic made one more cycle
> > than it would have otherwise if the vector location was stationary.
> > if you whip around that loop 50 times per second, the 2nd harmonic
> > will be detuned higher by 50 Hz.  if you whip around that loop in the
> > opposite direction, you will be detuning that 2nd harmonic lower in
> > frequency.
> >
> > the application where this might be useful might be with piano tones
> > or some other natural instrument with sharpened higher harmonics (like
> > above the 9th or 12th harmonic).  it's a different (and cheaper) way
> > of doing it than employing what they call "group additive synthesis"
> > where the higher harmonics are put into a different set of wavetables
> > and run in a different wavetable oscillator that runs at a slightly
> > sharp fundamental.
> >
>
> On the other hand, I find group additive synthesis conceptually simpler
> when dealing with inharmonic partials.
>
> What is the maximum detuning a partial can have with the wavetable
> method? Intuitively I would guess it's the same as the fundamental
> frequency, so the harmonic k could be tuned down to (k-1) or up to (k+1)
> at most, is that right?
>
> Risto
>
>
>
>
> _______________________________________________
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
```
```_______________________________________________
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp```