The PWM resolution depends on the frequency you configure the CCPR for. At higher frequencies (which you'd need for decent audio) the resolution will only be 8 bits. The frequency is pretty low for 10 bit resolution (depending on crystal frequency of course) Mike > -----Original Message----- > From: Kevin Blain [SMTP:kevinb@WOODANDDOUGLAS.CO.UK] > Sent: Tuesday, August 29, 2000 9:47 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Playing WAV files on a PIC > > Isn't the PIC PWM 10 bit anyway - so why worry about a 9 bit result? > ----- Original Message ----- > From: Olin Lathrop > To: > Sent: Monday, August 28, 2000 6:12 PM > Subject: Re: [PIC]: Playing WAV files on a PIC > > > > > As others have noted, mixing sounds is just adding. The gotcha is > that > if > > > you add, say, two 8-bit numbers, you will get a 9-bit number. > > > > > > The trick to getting it to sound good is in the editing of the stored > > > waveforms. To make the most of limited output resolution, you want to > > > carefully control the amplitude of the stored waveforms. If you do > this > > > properly, then your PIC code can safely ignore overflows because you > will > > > have taken care of them in advance. It would also be wise to filter > the > > > waveforms before storing them to get rid of aliasing. > > > > What you are suggesting is theoretically correct, but will lead to more > > quantization noise than storing each input at full amplitude. Suppose > you > > want to mix N channels, all at the same gain. Storing each channel with > a > > maximum amplitude of 1/N and adding them is NOT the same as storing each > > channel at maximum amplitude, adding them, THEN dividing by N. Of > course > > the latter method requires doing addition with more bits than the stored > > values, but this is trivial. If N is is kept to a power of two, then > the > > divide is just a shift. > > > > > > ***************************************************************** > > Olin Lathrop, embedded systems consultant in Devens Massachusetts > > (978) 772-3129, olin@cognivis.com, http://www.cognivis.com > > > > -- > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > use mailto:listserv@mitvma.mit.edu?body=SET%20PICList%20DIGEST > > > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu