[sdiy] Micro as a Linear to Exponential converter?

Colin f colin at colinfraser.com
Fri Aug 14 13:50:44 CEST 2009


 
> -----Original Message-----
> From: synth-diy-bounces at dropmix.xs4all.nl 
> [mailto:synth-diy-bounces at dropmix.xs4all.nl] On Behalf Of 
> Antti Huovilainen
> Sent: 14 August 2009 12:11
> To: Tom Wiltshire
> Cc: 'synth-diy'
> Subject: Re: [sdiy] Micro as a Linear to Exponential converter?

> I meant that when you have the generic MCU thing working, the 
> exponential 
> conversion (read: interpolated table lookup) itself truly is 
> trivial. You 
> can just write it all in C. MCUs are plenty fast nowadays.

In the case of the PIC I used, a couple of hundred bytes of RAM for a 16-bit
lookup table didn't leave much, so I had to put it in ROM.
I knocked up a spreadsheet that generated the expo lookup table directly in
hex format.
Just had to copy and paste it into a header file.
With middle C (MIDI note 60) aiming for 1 volt:
dac code = (2^(1/12))^(note - 60)*65536/Vref

I added columns in the spreadsheet to calculate the rounding error as it
went to 16 bits, which let me check the error in cents.
That showed me 12 bits wasn't good enough.

Cheers,
Colin f





More information about the Synth-diy mailing list