Go Down

Topic: analog audio in to PWM audio out (Read 4922 times) previous topic - next topic

g_u_e_s_t

i just finished an arduino sketch that allows decent audio processing with just a few resistors and capacitors.  the arduino sketch is up here:

http://wiki.openmusiclabs.com/wiki/PWMDAC

it takes in audio on ADC0 and uses a dual pwm to create 16b audio out.  you can process the audio in-between and make a low-fi effects pedal.  it can be used for just analog out as well, and is much higher quality than using analogwrite (although more complicated too).

there is a much more in-depth tutorial on pwm in general up here:

http://www.openmusiclabs.com/learning/digital/pwm-dac/

Hi
I have tried your code on my  Arduino Mega2560, it doesn't work.
Are the code for Atmega328 and Atmega2560 different?
Any hint to convert the code to Arduino Mega2560?

g_u_e_s_t

the ports are different between the mega and uno (what pins map to what functions), so those need to be changed.

xl97

HI.. (sorry for being thick headed here)  :)

but would this be used for AUDIO playback?  (like a .wav file?)  or just for use like, say.... a voice changer/voice effects type of project?

thanks!

g_u_e_s_t

it can output .wav, but there isnt an SD card reader setup for it yet.  so if you have something that can read SD cards, you can use the PWM to output it.  this is what the simpleSD does.

db2db

This is interesting. What might you use this for? Are there audio examples?

xl97

HI-

SimpleSD.. as in the SimpleSDAudio library?

(I have played with that before)

I guess Im missing a 'purpose' this can be used for then??

Was a wrong to assume it could be used for some sort of real-time voice changer/FX platform??


g_u_e_s_t

yes, its primarily for doing guitar/voice effects on the cheap.  but, the pwm side is just a generic setup routine to configure the pwm for various data rates and bit depths, so that can be used for any audio application.

db2db

Would be nice to see a full sketch that does some audio effects.


g_u_e_s_t

i have a sketch up here:
http://wiki.openmusiclabs.com/wiki/MiniArDSP

sorry, no sound samples yet.

dsese1234

This is nice sketch.. http://wiki.openmusiclabs.com/wiki/PWMDAC :) but how could i do the circuit for guitar signal?

g_u_e_s_t

if you take a look at the circuit here:
http://wiki.openmusiclabs.com/wiki/MiniArDSP

you just need to put a guitar preamp before it.  a simple opamp circuit with gain of 100 would be fine.

I have this sketch bread boarded with the analogue in circuit from instructable here.Thank you GUest, Brilliant!

All working a bit noisy but I am fine tuning resistor values and caps.
http://www.instructables.com/id/Arduino-Audio-Input/?ALLSTEPS

This is the project I am working on to use it with,

http://www.youtube.com/watch?v=05FuBKPvTgs

Just going to do a quick video and then ´´once more unto the breach´´

AdC/DaC highway to ped(Hell)

http://www.youtube.com/watch?v=Trb3UAXWNn8

Update on the hardware side of this project.
Links to all the helpfull and informative information sourced so far.

http://www.instructables.com/id/Arduino-Guitar-Pedal/?ALLSTEPS

http://www.instructables.com/id/Arduino-Audio-Input/?ALLSTEPS

http://wiki.openmusiclabs.com/wiki/MiniArDSP

http://provideyourown.com/2011/analogwrite-convert-pwm-to-voltage/

http://www.instructables.com/id/Lo-fi-Arduino-Guitar-Pedal/

https://github.com/telamon/ArduinoDSP

http://www.openmusiclabs.com/projects/codec-shield/

http://www.planetz.com/intro-to-diy-pedal-building/#more-1883

http://www.planetz.com/building-an-idevice-guitar-interface-cable/

I need to address the Resistor Values and also the reference ground voltage and also one of the capacitor values in this circuit.

I am encouraged with progress to date the next stage of the project is interfacing the guitar signal with Pure Data and adding additional controls as set out in the first video
so some more reading on Pduino.

These are really just bench notes again on progress to date still unresolved are the 5 way selector switch hack for the Pickup replacer selection so very much a work in progress.

Go Up