I've been looking into getting an Arduino Nano to experiment with some DSP ideas without the latency problems I have with using PortAudio on my desktop. They have great analogue input features, but outputs are sorely lacking. It's possible to hook up a DAC/resistor ladder, but each bit costs another digital IO pin and you only have 14 bits even if you leave nothing for control/etc. I notice that some of the digital pins can pulse width modulate a square wave to approximate analogue outputs, often used with LEDs, etc. so if I included a low-pass filter, could this be used for an analogue output?
(I have several years' programming experience including a decent amount of work homebrewing for GBA + NDS)
Thanks.
EDIT: Could I use two pins, both low passed, one with a low volume, to get 16-bit out?
You can use PWM for audio with some filtering, and yes, you can use 2 8 bit outputs to get 16 bits. Take a look at this project, it explains quite well how to get 16 bits resolution out of 2 8 bits pwm outputs:
(damn... the site seems to be down.... hunt for a project called TRAXMOD, it had a nice explanation on how to get those 16 bits combining 2 8 bits pwm outputs. Maybe you can use waybackmachine to get the page back)
here you have a cached copy:
http://web.archive.org/web/20110713131212/http://www.k9spud.com/traxmod/pwmdac.php (http://web.archive.org/web/20110713131212/http://www.k9spud.com/traxmod/pwmdac.php)
mat
See the datasheet for the VCLFO9D or the TAPLFO2. They both output PWM, and they both include example filters for smoothing the PWM, and swinging it +/-.
They do not, however, use the PWM for audio, just for LFOs.
Likewise, there is some filtering shown in my working draft (http://imageshack.us/photo/my-images/32/ttphaser.jpg/) of a tap tempo phaser that was working pretty good.
Mike
Ah, thanks, I suspected as much. I note that he uses straight-up resistors instead of resistor dividers; is there an advantage to this?
Found someone else had done the research and built something pretty decent:
http://www.instructables.com/id/Lo-fi-Arduino-Guitar-Pedal/step4/Normalize-the-Input-and-Output/ (http://www.instructables.com/id/Lo-fi-Arduino-Guitar-Pedal/step4/Normalize-the-Input-and-Output/)
I have built the Arduino Nano DSP and though it's not very powerful in mono you can get some seriously decent effects. My chorus:
http://soundcloud.com/nexekho/much-much-smoother (http://soundcloud.com/nexekho/much-much-smoother)
http://pastebin.com/2ed16VD0 (http://pastebin.com/2ed16VD0)
(note: designed for above circuit)