Couldn't you use a PC sound card based spectrum analyser for this? There are plenty "out there" to choose from. RP On 30/03/07, rolf wrote: > > Hi Scott, > > Thanks for your message. > Responses below. > > > From: Scott Dattalo > > Subject: Re: [EE] [PIC] ultra low cost audio out from a > > microcontroller (an update) > > To: "Microcontroller discussion list - Public." > > > > rolf wrote: > > > Well, I took the sage advice from the list and implemented > > > the Roman Black algorithm on my microcontroller. > > > > > > The results were mixed. > > > > > > > When you say that it seems like the noise in your implementation is due > > to the sampling frequency, do you mean that the sampling frequency was > > too low or that your sampling frequency was not stable? > > I meant the sampling frequency itself was audible. > That was obvious when the rate was around 11khz. > But, even at 44.1khz, there are components of lower frequencies that > appear. For example, if you are trying to represent a DC level of 0v > the 1 bit stream is 01010101... > Well, at 44.1khz sample rate, that appears like a 22.05khz wave. > That isn't really audible to me, but if it was a bit lower, it might be. > So, it shows how you are forced to use quite a high sample rate with 1-bit > algorithms. The part that you can hear is what I was referring to. > > > > > For this approach to work, it's absolutely necessary that the output > > samples are generated at a rate that exactly matches the pseudo analog > > node. The easy way to achieve this is by running the sampler at a > > constant rate and predicting how the output voltage will change given > > the current filtered output voltage, the next pulse, the duration of the > > pulse, and the filter's frequency response. > > I may have had a bit of this problem too. > I was using an interrupt service routine to output each sample. > > > > > BTW, I have not built this type of D/A before - so my insight lacks any > > practical backing. But here are a couple of suggestions that might help. > > > > First, the RC summing junction is the one that the algorithm attempts to > > model. As you note, to drive any kind of load an amplifier like the > > LM386 is needed. If you make the LM386 a low pass filter whose cutoff is > > above the RC but below the output sample rate, and at the same time > > > > Second, do you have access to an audio-bandwidth spectrum analyzer? If > > so you may try synthesizing a sine wave (e.g. 500Hz) and measure its > > spectral purity. It would be interesting to see how narrow the 500Hz > > spike is, how low the noise floor it, what the harmonics look like, etc. > > Also, it'd be interesting to see how strong the output sampling > > frequency is in the spectrum. > > Oh, that would be nice, but no I don't have that. > I have a 2 channel scope though. > > > > > Third, I'm not sure how you structured your code, but if you want to get > > some tips on obscure single-cycle resolution isochronous timing > > generation, then check out: > > http://www.dattalo.com/technical/software/pic/pwm256.txt > > > > Fourth, not a suggestion, but a question; did you experiment with > > different RC time constants? > > I did tinker with the RC values suggested by the Roman Black simulator. > I found that some variation (Like 50% off) didn't really make a huge > difference. Keep in mind that the sound quality is very crude! > On the other hand, no RC filter truly sounded terrible. > > > > > Scott > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist