increase sample time artduino uno analog

greetings
i have a merely question about the arduino uno . My purpose is to have one sound sensor connected to the arduino and get 100k samples /sec (because the song has Fs = 44100 hz and i want the double and a little more so 100k is fine) samples per second . Data will be stored in matlab and play it after it’s completed.Could you tell me what should i change from my code?

thank you in advance

code
void setup()
{
Serial.begin( 9600 );
}

void loop ()
{
int sensor = analogRead(A0);
Serial.println( sensor);
}

Per datasheet, the '328 can do 15 k samples per second at max resolution- I think 75 at lower resolution.

If you need 100k samples per second, you must use a uC that can sample as process data that fast, or an external adc that can, and a uC fast enough (depends on how much processing you need - on a16 mhz avr, that’s only 160 clock cycles per sample)

good you explain me how i can get 15k samples per second .

thank you in advance

Well, for starters, don't try to send 2 bytes down the serial line 15000 times per second when the serial line is 9600 baud and can thus only handle 1200 bytes per second. I think serial print stats blocking when the buffer fills up

You may need to fiddle with registers instead of using analog read to get the full speed, all the "easy mode" functions are inefficient.

For this job, you use a PC.

Serial.begin( 9600 );

If you are planning to send 3-digit numbers plus carriage-return and linefeed you will be able to send 960/5 samples per second (192). That is a lot less than 100000 samples. Regardless of the ADC sensor, this is your main bottleneck.

Since you need to sample at twice the frequency of the music, you could therefore handle 96 Hz music. You might be able to sample mains hum but not much else.

[quote author=Nick Gammon date=1435042785 link=msg=2287902] You might be able to sample mains hum but not much else. [/quote] :grinning: :grinning: :grinning: :grinning: :grinning: As I said, it is quite simple - this is a job for a computer, not a microcontroller. Possibly a Raspberry Pi, with an ADC (such as these but be warned, these are useless!).