What is the effect of the knocking at the end of Act 2 Scene 2?
The knocking designates the actual arrival of Macduff and Lennox, but its powerful effect is to startle Macbeth, who has just killed Duncan. Macbeth's first response to the knocking is: "Whence is that knocking? / How is 'twith me, when every noise appals me?" That is, "Where is that noise coming from and why does it bother me so much?" The noise piques his conscience. The pragmatic Lady Macbeth says they need to get dressed for bed (as if they were awakened by the sound), but Macbeth expresses remorse when he ends the scene with "Wake Duncan with thy knocking! I would thou couldst!" The knocking heightens an already suspenseful scene. At this point, the suspense is so high that Shakespeare introduces comic relief with the porter, who answers the door and jokes about the knocking. But as he is "the porter of hell gate," we don't forget about the gruesome murder that has just taken place.
The knocking also reveals that Lady Macbeth is afraid. Shakespeare structures the meter of Lady Macbeth's lines to reveal her fear: though she shames Macbeth for his fear, bragging that she's not the coward he is, the knocking knocks her off balance: she slips on the beat, overshoots the rhythm with a feminine ending, and staggers to control her stress that she loses on "the" and ironically on "retire" and "chamber," foreshadowing her eventual permanent dissociation from both. She regains composure until the next knocking again knocks her off balance; she falls but seems to catch the beat but misses the turn, hanging over the edge at the "us" to which she clings until she's calm enough for the conjunction "And."
My hands are of your colour; but I shame
To wear a heart so white.
Knocking withinI hear a knocking
At the south entry: retire we to our chamber;
A little water clears us of this deed:
How easy is it, then! Your constancy
Hath left you unattended.
Hark! more knocking.
Get on your nightgown, lest occasion call us,
And show us to be watchers. Be not lost
So poorly in your thoughts.