Sound cancellation

Hi,

I'm trying to ellaborate a simple sound cancellation system. The thing is i'm a beginner in programming. I'm on a due and i would like to directly send the signal which is detected by my mic on a speaker, after a short delay (100ms).

Here's my code for the moment :

int sensorValue;

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

void loop() {sensorValue=analogRead(0); Serial.println(sensorValue, DEC);

Pretty simple, now i want to inverse the signal, put a delay and send it on a speaker (with an amplification if necessary). I tried using PWM ports but it didn't work out. What shoud I do ?

Thanks