Lindy, Firstly, see if you can get a used copy of Hal Chamberlin's "Musical Applications for Microprocessors" (1985). This is the "bible" of digital music generation. Of course, it doesn't have too much code in it (but whatever there is is in (GW)BASIC), mostly conceptual. I assume the D/A stage is whatever you find works. I'll talk about the generation stage. I made a half-complete analog synth project with a PIC18 for school, though I used a 12-bit DAC since my synth had a "karaoke" feature for an external stereo input. To generate basic sines, a good way is to use Direct Digital Synthesis (DDS). This involves one lookup table (LUT), that can be full, half or quarter wave depending on how much precision you want and how much time you want to spend coding the looparounds for half/quarter-wave tables. There is an accumulator, which basically loops around the table at some rate, producing an output sine of varying frequency based on the accumulator rate. Depending on your accumulator precision, extremely accurate tone generation is possible...down to the hundredths of a Hz. Check out Analog Devices' excellent appnotes on DDS. Square, sawtooth and triangles are obviously much easier to generate (toggling, continuous increment/decrement), although these could also be implemented using DDS. The 18F's 8x8 multiplier lends itself to an excellent envelope generator/rudimentary amplitude control (although the overall volume control is much better done at the analog end, since you don't want to be dropping overall precision of the output digital stream). How the envelope generator would work would be to either use a segmented envelope made of increment, decrement, max, min, OR, for a complex envelope (curves/exponential/sine), again, either code it in, or to use DDS again, only this time you would not be looping indefinitely around the LUT. Manual control of pitch, etc. is as simple as using one of the PIC ADCs to sample a POT. Of course, the reason why the project is half complete is a lot of fancier things (tremolo, etc.) can be done in real-time with a DSP instead of a high-end MCU. I was also looking at using inverse Fourier transforms to directly generate multiple voice, multiple-timbre tones at one go (all the above I talked about would entail using multiple PICs for many "voices"...I had the DDS/linear-segmented ADSR doing either 3 unrelated fundamental-frequency tones or 4 octave-multiple (e.g. 220, 440, 880..) tones. My goal was to maintain a sample rate of 39.6125 KHz (1/256th of 10 MIPS), because of my external audio input. So this was all I could do in 255 instruction cycles. If you drop the sample rate, naturally you could fit more voices/effects onto 1 PIC. Since the new dsPICs are coming out, I'll probably port the project to it and continue work on it in my spare time. Cheers, -Ishaan Lindy Mayfield wrote: > Just thinking out loud, but what would a PIC have to do to be a synthesizer? > > One would need to start with the source, a wave form. This could either be generated mathematically or based on internal tables. > > Next would be to manipulate the characteristics of the sound. There is the pitch, controlled by voltage, a good use for the A/D maybe. Duration would be controlled by software. Timbre would be the wave form. Volume, I don't know how that would be done. > > The shaping of the sound's ADSR (attack, decay, sustain, release) could be done in software, I think (depending on how volume works). -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body