[sdiy] Stupid Lookup Table Tricks - BLEPs when you can't divide (and can barely multiply)
jschwich53 at comcast.net
Mon Jul 2 19:08:15 CEST 2018
I will say that even with 32 bit ARM chips that LUTs (Look Up Table) are essential. A lot depends on how fast the system needs to work and what it takes to do the computation for what you want. Then there is also the situation where you need some form of data that can't be calculated in system or the data varies and you have to put it in a LUT. I've worked on a lot of test and measurement systems where calibration data such as tables to linearize ADCs and DACs, filter coefficients and so on are used. Those things are usually calculated with a calibration setup and then programmed into flash tables for each individual system. There are a number of projects that I've worked on that I have used more flash for LUTs than for the actual program too.
From: Synth-diy [mailto:synth-diy-bounces at synth-diy.org] On Behalf Of Tom Wiltshire
Sent: Monday, July 02, 2018 2:48 AM
To: rsdio at audiobanshee.com
Cc: SYNTH DIY
Subject: Re: [sdiy] Stupid Lookup Table Tricks - BLEPs when you can't divide (and can barely multiply)
Don’t forget the golden rule on 8-bit processors:
“Don’t do hard sums!”
Look-up tables for anything even remotely taxing are essential. Then it’s just a question of working out how much accuracy you need in the table (both bit depth and table length) and whether you can manage with a simple table or whether it makes sense to interpolate. Even just reading two entries, summing and downshifting to create an extra table entry in-between every other one can help a lot - after all, you just doubled the effective size of the table.
Sometimes it is better to have excessive accuracy in the look-up table, especially if that gets you to a round number of bytes (e.g. using 16 bits when you only need 12). That would be my approach with these reciprocals. This also helps when interpolating, since you’re not introducing further error by having heavily quantised data to interpolate from.
Frankly, the errors introduced by simple linear interpolation have only very rarely been the cause of my worries. Usually the other limitations are more significant.
Synth & Stompbox DIY
> On 2 Jul 2018, at 06:59, rsdio at audiobanshee.com wrote:
> I didn’t look at any of this in detail. Does the Arduino sketch use interpolation of pre-computed table data? If so, wouldn’t that add distortion? ... and potentially aliasing?
> On Jun 28, 2018, at 4:00 AM, rburnett at richieburnett.co.uk wrote:
>> Neat! The quality is not bad but there is still quite a bit of audible aliasing even with the corrections enabled.
>> I think the problem is that your LUT of reciprocal values really needs a lot more resolution. It returns the same value for large ranges of input index. This heavily quantizes the positioning of the polyBLEP corrections and ultimately limits their effectiveness for the anti-aliasing.
>> You're only seeing about 20dB reduction in aliasing, and should be able to do much better than this in practice. But I think the implementation is being limited by the resolution of the reciprocal lookup.
>> The neat thing about polyBLEP is that the correction curves are simple functions, so you would ideally calculate these on a more capable platform, instead of using a pre-calculated lookup table. Then you are only limited to the numerical precision of the calculations and not the number of entries in a LUT. But I understand your motivations for doing it this way to see if it can be made to work :-)
>> FWIW, if you just want to generate anti-aliased sawtooths and pulse waveforms on a low-end 8-bit platform without oscillator-sync, then the best option is probably just to use wavetables. You store a whole load of sawtooth renderings generated by additive synthesis with progressively less harmonics in a lookup table. Every time you go up by one octave in pitch you switch to the next waveform from the table. Square an pulse can be generated by taking the difference of two phase-shifted sawtooths.
>> On 2018-06-28 01:14, Gordonjcp wrote:
>>> Why would you pick an avr8 to do bandlimited oscillators?
>>> Because folk say it won't work, that's why!
> Synth-diy mailing list
> Synth-diy at synth-diy.org
Synth-diy mailing list
Synth-diy at synth-diy.org
More information about the Synth-diy