What you want to do is basically the same as Echo cancellation in telephony.
http://www.voip-info.org/wiki/view/Asterisk+echo+cancellation is simple introduction. Also have a look at the pages for the mark and mark2 echo canceller there and the mentioned TI application note.
Also this site: http://www.embeddedstar.com/articles/2003/7/article20030720-1.html explains the mechanics quite well.
You'll have to intercept both the music player's output and the microphone input, and then pass the samples via some sort of IPC into your DSP process. JACK actually does this, but setting things up (e.g. ALSA->JACK bridge, if your music player and/or Skype does not natively support JACK as sound interface) does require some skill.
I guess it could work fairly well, but it probably requires quite some CPU. Especially XRUNS (audio buffer under- or overrun) can be really bad for your echo canceller, i.e. you might need realtime linux kernel patches. Implementation is not trivial, either. Also having stereo sound from your music player will reduce your cancellation success.
SOURCE : http://stackoverflow.com/questions/4875818/software-sound-cancelling-destructive-interference-tools-on-linux