To be clear, the tapping occurs in the past. The entire series of events in the poem occur in hindsight. The speaker is reflecting back on this bleak night and we know this by the opening phrase "Once upon a midnight dreary" - which is a darker version of "Once upon a time."
But as the speaker goes back to this night, the tapping first occurs in the first stanza, just as the speaker is about to fall asleep after reading a book:
While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
The speaker responds to his supposed visitor and then opens the door to see if someone is there. He finds nothing, "Darkness there, and nothing more." He whispers the word "Lenore" (a lost love) into the darkness and retreats into his room. Then he hears the tapping again yet louder, and concludes that it is coming from the window. He opens the window and in flies the raven. The tapping clearly stops here and the remainder of the poem is the speaker trying to understand the meaning of the raven's single answer "nevermore."