Noob trying to make a guitar project using an Arduino and somewhat confused.

Board : Arduino Mega ADK (Atmel 2560 16AU)
Goal: Make a guitar pedal I can create which doesn't require pure data and instead can be done in sketch.

Problems:
I have only a passing understanding of whats required but want to learn more. I have read quite a bit but understand very little so I will try to post what I think are the problems accurately.

I have tried plugging my guitar into the Arduino and using the 'standard-firmata' example in sketch I managed to observe a voltage input from my guitar in the correct analogue port(A0) of around 0.1 volts however I am not sure exactly how to get this out of the PWM ports. I did this all because I saw a Pure Data project, however Pure Data seems to require the computer to be connected to the guitar pedal which is not what I want besides that I could not get a coherent output from the arduino doing so.

I also read that there is a possible limitation on the frequency in which I can expect a response however given the video's I've seen I expect that may not entirely be true unless they only used the Arduino to sense values of switches and pots and let the computer itself handle the effects.

What i need:
A reason as to why I cannot get a decent sound out of the thing by simply just asking the arduino to read in the input signal and read it out again unchanged or amplified.

An answer as the practical limitations on the frequency input and whether the ADC can sample and process the input signal in a detailed enough manner to output a decent effect in real time. And yes I saw the lab experiment post of the guy from cologne university however his circuit seemed to be more custom built and I am unsure as to the similarities and differences as I am just using the simple Mega ADK between my guitar and my guitar amp at the moment.

Anything I have failed to clarify I will happily do so.

Thank you.

What i need:
A reason as to why I cannot get a decent sound out of the thing by simply just asking the arduino to read in the input signal and read it out again unchanged or amplified.

One does not "read it out again". One "writes it out".

What is the "input signal"? Is it digital or analog? How frequently do you need to read it? What are you doing with it after you read it?

Where is your code? What does it do? How does that differ from what you want?

Unfortunately making something that will sample audio and then play it out again in an acceptable way cannot be done using the standard arduino functions. There is too much overhead in using the functions such as analogRead, and also the PWM output will need to run at a much higher frequency to provide the frequency response required for audio generation. That being said, it is possible.

See: http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/

This makes use of the timers on the atmega to sample and process the audio data regularly. By using timer interrupts this makes it a realtime operation, rather than when it gets to that point in your sketch.

In addition, you will probably want to buffer your guitar input and do some level shifting to make sure it's between 0 and 5V. A simple op-amp buffer will work nicely for this, with a virtual ground created at 2.5V. A LM324 or other low voltage single supply op-amp will do (given that the arduino is going to massively reduce the fidelity of your signal this op-amp will do fine).

The other thing you will need to do is filter the output to remove the switching noise, the link above has a simple filter. You can omit the inductors and just use capacitors and resistors though, google RC filter.

good luck!

Make a guitar pedal I can create which doesn't require pure data and instead can be done in sketch

Well unless we are talking about a guitar from the game Guitar Hero, I'm pretty sure that the input will be analog.

This sketch

http://interface.khm.de/wp-content/uploads/2008/10/arduino_audio_phasor.zip

anwser the affirmation:

A reason as to why I cannot get a decent sound out of the thing by simply just asking the arduino to read in the input signal and read it out again unchanged or amplified.

I tryed and it does sound pretty cool.

And this circuit

show that it's fairly easy to do.

Yeap aayotee found the right page to help you with your project.

Something like distortion effects or echo can be fairly simple, but in general DSP (digital signal processing) is an advanced mathematical & programming topic.

I have tried plugging my guitar into the Arduino and using the 'standard-firmata' example in sketch I managed to observe a voltage input from my guitar in the correct analogue port(A0) of around 0.1 volts however I am not sure exactly how to get this out of the PWM ports.

The [u]Audacity website[/u] has a good basic introduction to digital audio. When you digitize audio, you sample the waveform (voltage) at a known constant rate. i.e. CDs are sampled at 44.1kHz (44,100 times per second). When you want to convert back to analog (from your digital-to-analog converter), you "connect the dots" (with a low-pass filter) and you have continuious analog again. Obviously, timing is important and you have to play-back at the same sample-rate you recorded (unless you do some digital sample rate conversion, etc.)

This type of encoding is called PCM (Pulse Code Modulation). The Arduino's ADC (analog-to-digital converter) is fine for PCM, but the Arduino's PWM output is not a "proper" DAC (digital-to-analog converter). Also, the Arduino's ADC is only 10-bits. Maybe that's OK for guitar effects, but it's not "high-fidelity". (CDs are 16-bits.)

You also need to bias the AC signal, since the Arduino cannot accept negative voltages

I managed to observe a voltage input from my guitar0.1V

That seems a little low... Usually you can get positive & negative peaks about 1V out of a guitar into a high-impedance load, but it edpends on how hard you pick, how "hot" your pickup is, and the guitar's volume control. So 0.1V might be normal for your setup.

You might need to amplify the signal or lower the Arduino's ADC reference. With the default 5V reference the Arduino's 10-bit ADC has 5mV (0.005V) of resolution and at 0.1V you are only using about 5 bits.

Let's get down to this Mister God you are saying:

You might need to amplify the signal or lower the Arduino's ADC reference. With the default 5V reference the Arduino's 10-bit ADC has 5mV (0.005V) of resolution and at 0.1V you are only using about 5 bits.

So basicaly you saying that he should put the about 2 volt to the ARef pin on the Arduino?

So basicaly you saying that he should put the about 2 volt to the ARef pin on the Arduino?

There's little point providing an external high voltage reference when there's a perfectly good low voltage INTERNAL one available, but then 100mV would only cover about six-and-a-half bits, so amplification is still preferable.