[sdiy] Micro as a Linear to Exponential converter?
Tom Wiltshire
tom at electricdruid.net
Fri Aug 14 13:35:00 CEST 2009
Fair enough. That is pretty trivial.
Your original point was that the hard part is avoiding quantisation,
resolution error, and aliasing, and that's definitely true.
The biggest trouble with stuff like this is that once you've gone
down this road, it's hard to know where to stop. Say you've built a
digital exponential convertor as suggested. Now you want to feed a
vibrato LFO to your oscillators. You *could* use another A/D input to
sample an analog LFO, add that to your frequency control word (note &
frac in Antti's code) and bingo! But then again, wouldn't it be
easier to do the LFO in the MCU directly and avoid the A/D conversion?
After all, you could easily have loads more LFO waveshapes, and you
could easily do LFO frequency mod, and MIDI sync, and, and.
What about a pitch envelope? That'd be just as simple, right? Well,
yeah, it would...
This (pretty convincing) logic leads you along a path at the end of
which you find yourself with all your modulations done digitally, and
only emerging into the analog world at the final DAC which drives CVs
for the Oscs, VCF and VCA. And then you have to sit down and write
software for something akin to Oberheim's Matrix Modulation.
Or is it only me who gets carried away like this?
T.
On 14 Aug 2009, at 12:10, Antti Huovilainen wrote:
> On Fri, 14 Aug 2009, Tom Wiltshire wrote:
>
>> I'd just like to agree with Colin's outlined scheme above. I've
>> done similar things. Antti's comment that "the code part is
>> trivial" is a bit misleading, IMO.
>
> 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.
>
> Example code below:
>
> unsigned short noteTable[128];
>
> // note = 0..126, frac = 0..65535 (equivalent to 0..0.99999)
> unsigned short expo(short note, unsigned short frac)
> {
> long l1, l2, f, y;
> f = frac;
> l1 = noteTable[note];
> l2 = noteTable[note+1];
> y = l1 * 65536L + (l2-l1)*frac;
> return (unsigned short) (y >> 16);
> }
>
> Antti
>
> "No boom today. Boom tomorrow. There's always a boom tomorrow"
> -- Lt. Cmdr. Ivanova
>
More information about the Synth-diy
mailing list