I'm working on the headphone jack module, and I don't hear any high pitch distortion due to PWM, even with an HiFi headset (Sennheiser HD428). I may add an optional capacitor on the PCB for those who want to add a first order low pass filter, but I don't think it will be really useful.
Well, that confirms that feeding OCR2B to DAC is the way to go for emulating sound
Hang on, I'm confused now, how exactly are you generating your triangle waves? It's impossible to do full 8-bit triangle waves with the standard Gamebuino mixer because it mixes at 15000 samples per second; at 440 Hz you can just about manage a 5-bit triangle wave or a 4-bit sawtooth wave.
It might be worth me hooking a oscilloscope up to mic and seeing how various waves are being reproduced by the Gamebuino speaker, can you provide the mixer code you're using to generate the waves?
I am perhaps confusing because I do not use any Gamebuino library code. I am talking in the context of whats possible w/r to the hardware, not w/r to Gamebuino lib. Sorry about that, should be more specific.
Timer1 ISR fires (what was it) 31250 times per second. For a 440Hz saw wave 2 x 35 steps between 0 to 256. Enough resolution to make a saw wave - at least in my view. The sound is different from a square wave. I'll try to record more demos to demonstrate.
(EDIT: lousy video but you can hear the difference between saw and square + you can hear the whine with the saw wave. If the "whine" was a result of some electric interference, I think it should be audible in the square wave as well. I can only attribute it to the way the signal is formed due to PWM ... but I might be wrong. I always though that this was _the_ reason why all Arduino synths I have seen have some sort of a low-pass filter.)
Here's a screenshot of a 30 Hz saw wave, period (0.032sec) is 31Hz (slightly off from 30Hz setting).
I have a function pointer table for different oscillator functions (saw, triangle, noise etc), each oscillator function is addressed simply by redirecting the function pointer (which the ISR calls). Saws and triangles are all handled with simple precalculated dx,dy counters to avoid multiplication and/or division.
//... and then some mixing code that combines the outputs of the two oscillators into OCR2B
It is possible I have misunderstood completely how this whole thing works. On the other hand, I do get the kind of audio signals I am expecting.
Having said that, it would be extremely interesting to see oscilloscope images of Gamebuino output. I'd be very interested if you sometimes took the time to grab a few pictures of what the audio signal actually looks like. Square signal we all know. What happens to "PWM faked" signals like saw waves is more interesting.