[sdiy] My latest project

Tom Wiltshire tom at electricdruid.net
Tue Feb 16 19:00:30 CET 2010


On 16 Feb 2010, at 16:59, Dave Manley wrote:

> Tom Wiltshire wrote:
>> Hi all,
>>
>> I'd like to show you what I've been up to recently:
>>
>> http://www.electricdruid.com/images/dualchannelvoice.jpg
>>
>> It's a digital/analog hybrid dual channel synth voice. The uP  
>> generates two audio channels (currently two pairs of PPG-style  
>> wavetable oscillators) and modulation sources (currently four LFOs  
>> - I haven't done any envelopes yet.) and outputs 8 CVs via four  
>> dual DACs. The 8 CVs control two SSM2044 filters and dual stereo  
>> VCAs based on a SSM2164. So it's two channels of DualOsc/Filter/ 
>> StereoVCA. It's also the thread that ties all the random questions  
>> I've been asking together.
>> This evening I got the pan law for the stereo VCAs sorted out, and  
>> that's the last of the hardware working. It lives!
> Hi Tom,
>
> Looks like fun.  Can you give some details of how you implemented  
> the oscillator timing in the dsPIC?  Which features of the dsPIC  
> are in use, sample rate, etc?

I had a conversation with Antti H. about it, and he gave me loads of  
good advice, like doing all the processing in blocks. I'd previously  
worked on a single sample at a time, but generating 16 at once is  
much faster. The sample rate is 89KHz, I think, blatantly not enough  
for the simple PPG oscillator scheme I'm using, but currently I don't  
care. That's a problem for later, if it's a problem at all. The audio  
DAC generates the sample rate clock itself, by requesting samples  
from the DMA hardware. Two DMA channels (L & R) are used to transfer  
data from the audio buffers to the DAC, so this doesn't tie up the  
processor. There are two buffers, and the DMA hardware generates an  
interrupt when it finishes a buffer. The interrupt sets a flag for  
the main code telling it which buffer is empty, and in the meantime  
the DMA reads the other buffer.
The CV DACs are connected via SPI. Unfortunately the need to change  
chip select lines every two values makes using DMA impractical/  
borderline useless for sending the CV data, otherwise I'd have used  
another DMA channel to move CV data from the final CV variables to  
the CV DACs. As it is, the main code has to do it, but it takes so  
little time to send 8 words at 10MHz that it isn't a problem.
The modulation sources are calculated after the audio buffer is  
filled, so the modulation rate is 1/16th of the audio sample rate -  
over 5 KHz, plenty fast enough.
I'm trying to apply my new DSP techniques to the modulation sources,  
and calculating them in a loop. As I said, I've done LFOs, all four  
calculated in one loop. I'm hoping to do something similar with  
envelopes. The tricky bit is finding ways to 'rephrase' things so  
that you don't have to have any code that branches - imagine writing  
an entire program with no "if" statements. Mostly it *can* be done,  
and I'm having great fun trying to squeeze more into less.

T.




More information about the Synth-diy mailing list