Programming wave tables into a picaxe?

andrew_qld

Senior Member
Interesting that they have squeezed that into a ATTINY45.

This is the basic principle used by DDS (Direct Digital Synthesis). You take an analogue waveform and store digital samples of it in memory. You can then play the it back over and over to get the original signal or do things like play it back twice as fast and get a signal at twice the frequency. You can buy off the shelf DDS chips that do this, but they are expensive.

It usually takes a LOT of memory though to achieve good quality. I think a picaxe version would probably need an external EEPROM to store the waveform (at least for an 08M or 18X version), but it would make an intersting project.

A 28X or 40X running at 16MHz using a crystal should be able to generate RF up to a MHz or so with this... Hmmm, I can see a Picaxe signal generator project coming out of this!
 

hippy

Technical Support
Staff member
Interesting timing. Over on the Dark Side I'm designing an entirely digital music synthesiser - I always wanted a synth but VCO's and VCA's are so complex for us digital types ! That handles six oscillators, eight ADSR's and mixing. Various waveform tables, ring modulation, frequency and amplitude modulation all done in around 44uS so far ( at 20 MIPS ), max freq 7812Hz at 64uS tick. Analogue output is by PWM and a simple RC network.

Memory usage isn't so bad, 256 byte sine table, ramp and square all derived from the phase accumulator. Code is around 1KB. Sampled / non-sine wave tables are what takes up the space.

A similar device, but not open source, is Savage Inovation's Soundgin(TM) which is the inspiration for what I'm doing ...

www.soundgin.com

That's based on a PICmicro 18F1320 running ( probably ) at 10 MIPS. The user manual there is a very good read for anyone interested in music generation. Very nice graphical control software available, and it's serially controllable. And it does speech !

Speed is the real key to good sound. Even the humble SOUND command does well at 4MHz but to get sine wave outputs there's a lot more to be done and multiplying to do amplitude modulation is quite time consuming.
 

andrew_qld

Senior Member
Very interetsing- I'm impressed. Those spinny twirly things handle audio natively anyway don't they?

I always thought you would need more than 255 levels (I'm assuming 256kb x 8 bits = 256 samples at 255 levels?). Then again I guess the RC smoothes things out, and after all, the early PC's only had 8 bit sound cards.

I wonder if you could get a decent RF waveform with 8 bits? My own interest in this is along the lines of a picaxe antenna analyser / impeadance bridge along the lines of this picaxe version http://www.users.on.net/~endsodds/analsr.htm but with a completely diferent RF generator section, and something to measure the RF output power (like an AD8307).
 

hippy

Technical Support
Staff member
Its' the one thing seriously lacking is on-chip ADC, although it can do Sigma-Delta ADC if resources are thrown at it. Nowhere near as satisfactory as a PICAXE.

The sine table was just 256 x 8-bit entries but the Rom has a 2048 step sine table. I couldn't hear any noticeable difference at 1kHz from either. At 1kHz the table is stepped through quite fast with just 28 steps of the 256 used. AIUI, because the steps roll through on each complete cycle it gives a much nicer sine wave overall. I don't really understand DDS beyond the basic theory.

I reckon you could get fairly decent RF out with a bit of effort, in fact there's a thread related to that on the Dark Side forum.
 
Top