Pages: [1]   Go Down
Author Topic: Audio record and playback  (Read 987 times)
0 Members and 1 Guest are viewing this topic.
Montreal
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm trying to achieve audio recording and playback with the Arduino. Of course, I don't expect a very high sound quality, but right now what I get just doesn't work at all.

For now, I followed the advices in the following post: http://a.parsons.edu/~chainreaction/?p=143, so I tried pluging my laptop headphones output in the Arduino. It seems to be partially working: I can see the value from analogRead() change when there is sound. With the following code, I also get "something" from the output that is a bit like the input (although its very noisy):

Here is my code:


#define AUDIO_INPUT 0
#define AUDIO_OUTPUT 9

int audioIn;

void setup() {
  pinMode(AUDIO_INPUT, INPUT);
  pinMode(AUDIO_OUTPUT, OUTPUT);
}

void loop() {
 audioIn = analogRead(AUDIO_INPUT);
 analogWrite(AUDIO_OUTPUT, audioIn);
}


The problem I seem to have now is that the sampling rate of analogRead() seems to be very slow according to the following post: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1167113121/9#9. It seems to take at least 1 ms.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try Arduino 0008 - the delay's been removed so analogRead() should be much faster.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I also get "something" from the output that is a bit like the input (although its very noisy):


Have you gotten any further with this?

I'm trying the same thing and, while I don't expect much quality, it seems way worse than it should be.

Logged

Pages: [1]   Go Up
Jump to: