Question about MSP tutorial "Waveshaping"

chk's icon

Hey all!

I am making my way through the MSP tutorials in the reference... is there anybody who could explain to me, why the input signal for the lookup~ object is scaled by 0.99? It is not explained in the tutorial.

Any tips and help much appreciated, thanks!

Sébastien Gay's icon

That's a fair question : I overlooked this point when studying the tutorial recently...... as far as I understand, [lookup~] is supposed to do nothing here, since the transfer function is y=x. Scaling x by 0.99 only brackets y by the same factor ? Is it a rounding issue ? Indeed, played as is, you only get a 220 Hz peak. But changing 0.99 to 1. adds waves of partials....

Sébastien Gay's icon

Thanks ! Just trying to understand a bit better :

lookup~ treats '1' and '0' as the same address, so you do this to avoid repeated values...

do you mean that when x reaches 1, [lookup~] outputs the same value as for x=0 (0, in this case) ?

lookup~ is meant for use ideally with phasor~

even if [lookup~] accepts negative values ?

Sébastien Gay's icon

No worries at all, R∆J∆.
I'll need more time to review the material you just posted, but many thanks already for providing it.

Christoph Kirmaier's icon

Thanks for all your answers! I also figured out that it works perfectly, when the buffer is 1 time bigger than it is read from, does that make sense?

Max Patch
Copy patch and select New From Clipboard in Max.

chk's icon

More details here, after some follow up investigations.

If in my example, if the buffer~ wt is set to an odd number (511, 513, 515), I can use the same number as the size of the lookup table. If it is even, I need to decrease the lookup table size by 1. In these cases I don't hear sidebands when I leave the amplitude of the input signal at 1.

Any thoughts or explanations on this?

chk's icon

Is this a bug?

👽!t W∆s ∆lienz!👽's icon

it's probably by design: odd numbered table-sizes allow for the 'scaling'/'ranging' of an indexing 'phase'(between -1 and 1), to observe a true middle-point of the wavetable(at phase: 0.), otherwise, if you attempt to range an even numbered table size between -1 and 1(for phase), but still want the exact middle of the wavetable to be indexed by a phase of '0.', you'll hit a sample-number which is not an integer when using even-numbered table-sizes.

this is good to review interface and sound wise: when you think about the sound, it's best if, while the input signal is silent, the part of the wavetable accessed is a sample which is also silence.
with a bipolar waveform that forms a complete cycle, the middle of the waveform should be the 0-crossing point = silence.
the bipolar lobes of the waveform that extend out from either side of this 0-crossing point should then be equal in size on both ends = odd-numbered wavetable-size.

tl;dr - the bipolar phase we use to index/read the wavetable requires an odd-numbered wavetable size to find a proper/exact middle-point sample(i.e. find an exact integer address when indexed by 'phase of 0').

chk's icon

Thank you for your answer, but I am not completely convinced... The output gets interpolated, so in theory there should also be a 0 at the middle in this case, even with a buffer of even samples. Is this documented anywhere, if it is by design?