How to capture voice and playback with Arduino

Hi all.

I'm trying to make a (apparently) senseless experiment.
The idea is to capture voice and sound from a microphone and simply riproduce the sound
through a speaker.

I assume that both microphone and speaker has to be connected to the PWM in some way.

I also really don't know what Arduino can read from the microphone PWM and if it's possible to
send these values to the destination PWM.

Any suggests appreciated.

BYE !

Basically you do not have enough memory to store anything but a small fraction of a second of speech on an arduino.

Therefore you need to get into sound shields with things like SD cards and external d/A converters. There are commercial ones available.

Hummm, I wonder how fast is the max sample-rate of the analog input...

Depending on what he wants to do, there's no need for much memory. In any event, a cheap FLASH or EEPROM 2-wire chip could do the trick. Just don't know what would be the rates to record and read from those.

Wk

Hummm, I wonder how fast is the max sample-rate of the analog input

That is fine, it's not the problem.
You can't write to flash or EEPROM fast enough, especially over the i2c bus. You might just get away with SDRAM on i2c running at 400KHz but you still have the output side, PWM doesn't hack it.

In the arduino default code its something like 9.6Khz, the maximum is almost 15.2Khz.

Thank you very much for your replies.

Basically 9.6 Khz is enough for me, telephone quality is acceptable for this project.

I don't need to store the voice recorded but just "route" values from the analog in to the speaker.

Something like:

val = analogRead(..);
analogWrite(val,...);

My confusion is actually on signals and the pin to connect.

Microphone must be amplified and connected to an analog pin, but I don't know how to connect the speaker (PWM ?)
and how to convert analog values read from microphone to something useful and correct to write on the speaker pin.

MIC --> OP AMP --> ANALOG IN (?????) PWM --> SPEAKER

Is it right ?

Thank you very much.

I don't need to store the voice recorded but just "route" values from the analog in to the speaker.

So why have it going into the arduino in the first place, surely a piece of wire would do.

Analogue in returns a 10 bit number, the PWM needs only an 8 bit number so you have to convert the sample between reading it and spitting it out. Something like
analogWrite(13, analogRead(0) >> 2) ); would do it.

Grumpy_Mike:

I don't need to store the voice recorded but just "route" values from the analog in to the speaker.

So why have it going into the arduino in the first place, surely a piece of wire would do.

Analogue in returns a 10 bit number, the PWM needs only an 8 bit number so you have to convert the sample between reading it and spitting it out. Something like
analogWrite(13, analogRead(0) >> 2) ); would do it.

Eh eh eh I'm studying this to get in confidence with different kind of signals.
Next step is to send the read value to another arduino via radio to play the voice with a remote speaker.

to send the read value to another arduino via radio to play the voice with a remote speaker.

That's the bit I told you that you couldn't do. Best of luck at doing it or redefining the success criteria.

Mmmmmh .. well, I can't believe isn't possible to build up something easy like a walkie talkie with Arduino :slight_smile:

Used many digital walkie talkies then? :wink:

Analogue transmission is a whole different ball game to digital transmission.

I think its totally possible, maybe even using a cheaper FM transmitter, but heck, in the Arduino you could use Xbee.

Wk

Well, for the transmission it's easy to use some radio module.

But I still don't understand if it's correct to send value read from the analag in to the module to the other board :smiley:

And if it's possible to play back again to the speaker.

bye!

Hi un1x

My Last project (when I was a student) using a PIC record sound from a mic and the phone line the pic buffered it and streamed it to the PC.
I used a 20Mhz Crystal and were able to get 12Khz.

The Microphone Amplifier

A LM324N a low-cost operational amplifier is used to amplify the microphone to an audible level. Two stages are used the first stage gives a amplification of +- 45 (R7/R2), R5 is set to +- 22K? and the second stage give an amplification of +- 22 ((R9+R5)/R8). The two stages combined give a total amplification gain of 990. R3 and R4 provide a center voltage of 2.5V for microphone and is connected to the first stage. C8 only lest the AC audio signal through. R11 and R12 provide a center voltage of 2.5V which is connected to the ADC input on the Microcontroller.

Attached is the diagram for the MIC interface.

Regards

Luan

the pic buffered it and streamed it to the PC.

So how much memory did this PIC have?

Hi

I don't remember, it was a pic18F2550, I buffered 32 bytes at a time to the PC and the PC saved all the bytes, when the recording was done the PC converted it to a WAV file.
The PIC only streamed the audio to the PC.
I wroted code in C Builder to write the buffer to a file and then used a WAVE Module by Timothy J. Weber. to conver it to a wav file,

I did the project in 2007 You will have to goolge for the module.

Hope that helps

Regards

That chip has a USB 2.0 full speed interface on it, is that how you were able to transfer so much memory so quickly?
Remember the arduino only has a serial port.

Hi Grumpy_Mike

I used the CDC Class (128000 // baud rate) and not the full USB on the PIC, Because I used a serial driver on the PC It looked to difficuled to use full USB and I did not have a lot of time to complete the project.

I was just trying to contribute to the form.

Bye for now

Thank you very much Luan, I really appreciate it.

Bye !

Guys I havent read everything here, but this is more than possible. Using an AVR I stream straight out of a pwm pin 8KHz wav files stored on an sd card. It was reading the data into a buffer, while sending the values of a second buffer full of wav file to pwm0. Worked like a charm