you should put 2 sensors - one outside (a) and one near your ear(b) . Then you should perform math such as :
b - a*k = c is signal you should send to your ear .
Your system should calculate signal transfer coefficient k in real time as if you will change the possition and signal level from outside received at your ear will be changed .
But because of sound reflections from walls in your room and different way the noise is coming from outside you wont able to cancel noise fully -
signal sources will have different phase and different levels compared to what you got from sensor a.
If i am not wrong it is not new idea - i heard about that few years ago.
Other solutions include :
- try to give up study first
- if you can't - brick the window.
- then change the house if walls are too thin
- and finally destroy outside road with explosives if you are little bit lazy to do above