News:

SMF for DIYStompboxes.com!

Main Menu

Low pass a PWM?

Started by nexekho, September 01, 2011, 05:54:53 PM

Previous topic - Next topic

nexekho

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?
I made the transistor angry.

potul

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)


.Mike

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 of a tap tempo phaser that was working pretty good.

Mike
If you're not doing it for yourself, it's not DIY. ;)

My effects site: Just one more build... | My website: America's Debate.

nexekho

Ah, thanks, I suspected as much.  I note that he uses straight-up resistors instead of resistor dividers; is there an advantage to this?
I made the transistor angry.

nexekho

I made the transistor angry.

nexekho

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://pastebin.com/2ed16VD0
(note: designed for above circuit)
I made the transistor angry.