---------------------------- Original Message ----------------------------

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

From: "Risto Holopainen" <ebel...@ristoid.net>

Date: Mon, March 12, 2018 1:19 pm

To: music-dsp@music.columbia.edu



> �

> Thanks for your friendly comments, Robert!

> First of all, I probably need to clarify that I'm not trying to make a

> traditional synth application out of these wavetables, but I will use

> some of them in my own compositions in one way or another.


>> 1. "The wavetables are written to an array expected to be of type

>> double, float, or long double, and of odd length."�

>> why an odd length???�


> Maybe that's not necessary when I think about it. But the oscillator

> I've written expects a wavetable where the first and last entry are

> identical, for the purpose of convenient interpolation. For waveforms

> that are symmetric about their midpoint it's practical that both halves

> of the waveform fit into exactly the same number of samples, and then

> there's the guard point at the end that makes the size odd.


>> expect to do linear interpolation with the large and upsampled

>> wavetable to get rid of quantization error.


> Yes, the oscillator does linear interpolation.

i understand.� that extra repeated point is for linear interpolation.

so for a 1024-point wavetable you have 1025 elements to your table indexed from 
0 to 1024 and x[0]=x[1024].

i would still recommend a power of two (so that circular indexing is easy) with 
that one extra repeated point at the end.

>> 2. "Choose a waveshape, find its Fourier series, and add up a limited

>> number of partials to make a strictly bandlimited waveform."�

>> this is good advice.� it is the advice i give when using wavetable to

>> do "classic analog" waveforms like saw and triangle and square and PWM

>> and even master-slave sync-saw or sync-square.� It is pretty easy to

>> use the FFT and iFFT to do this.� use a big-long FFT (like 1 Meg

>> long).� you can prune it down to 2048 or 4096 later.� we can discuss

>> the detail of how to do this wavetable harmonic pruning in a later

>> music-dsp post.


> Yeah, I realise the FFT is the way to go to make arbitrary waveforms

> bandlimited. I've done a few Fourier series by pen and paper so far, but

> I think I'll leave out the FFT from this small library.

it's just that you can "draw" (or define) whatever time-domain waveform, put a 
single cycle of it in a huge FFT buffer, FFT it, remove the harmonics that will 
alias, and inverse FFT and you have a bandlimited waveform.� you can uniformly 
"sample" that huge FFT
buffer to get 1024 or 2048 or 4096 or whatever point wavetable.


>> 4. wavetables can be interpolated between each other to morph tones

>> between different MIDI NoteOn pitches, between different MIDI key

>> velocities, between different MIDI mod-wheel settings, and between

>> wavetables extracted at different times during the note evolution

>> between NoteOn, NoteOff, and when the note finally dies after

>> NoteOff.� One will need to extract wavetables more densely around the

>> NoteOn attack portion than during the decay of the note.� to do this

>> right, the wavetables need to be aligned to each other, perhaps

>> spinning one wavetable so that its circular cross-correlation is

>> maximum to its adjacent wavetable that it is being interpolated with.

> And that's already four dimensions of wavetables!
that would be expensive (you double your computational cost for each time you 
add one dimension).� you wouldn't necessarily do all four.� maybe time elapsed 
since NoteOn, MIDI key velocity, and MIDI pitch for three
dimensions.� or maybe two of those plus some expression pedal or slider or mod 

>� I've barely tried some

> timbral morphing and pitch interpolation, and not even simultaneously.

> But perhaps you can get away with a two dimensions of wavetables, one

> that drops off harmonics as pitch increases and another one for

> miscellaneous modulation effects?
sure.� (no MIDI key velocity and no elapsed time since NoteOn.)


>> 5. you can also interpolate between wavetables to **selectively**

>> detune some partials away from their harmonic value and not other

>> partials (that remain harmonic to the fundamental).� you do that by

>> crossfading to other wavetables that are identical but with some

>> harmonics shifted in phase.� a change in phase means a detuning of the

>> frequency of the partial from the harmonic value.� to do that, the

>> dimension involved should be made circular like with cylindrical

>> coordinates.




> I hadn't thought of that way of doing it. Wouldn't you have to crossfade

> between the wavetables with phase offsets several times each cycle for

> this to work?
depends on how much detuning.��
> And I don't quite see what you mean by cylindrical

> coordinates here, so if you don't mind, please elaborate.

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.��
now imagine that the arithmetic you employ in only that dimension is modulo 6 
arithmetic.� so if you
add 0.5 to 4.75, you get 5.25.� but if you add 0.5 to 5.75, you end up with 
0.25, it wraps around.� if you employ modulo arithmetic in that dimension, it 
is like you took the piece of 2-dimensional paper and curled it around so that 
5.999 gets butted up against 0.000 instead of
6.000.� actually 6.000 and 0.000 is at the same place.� what used to be a flat 
2-dimensional plane is now a cylinder.� along the length of the cylinder there 
is a min and a max and you should limit movement to between the min and max 
(with saturation arithmetic).� but along the
other dimension, going around the cylinder, there really is no min nor max and 
your arithmetic wraps around, just like fixed-point binary numbers do.
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.


r b-j� � � � � � � � � � � � �r...@audioimagination.com

"Imagination is more important than knowledge."

dupswapdrop: music-dsp mailing list

Reply via email to