Während ich die Gitarre spielte, klopfte jemand an die Tür.
Während ich die Gitarre spielte, jemand klopfte an die Tür.
Are both of these sentences grammatically correct?
German Language Stack Exchange is a bilingual question and answer site for speakers of all levels who want to share and increase their knowledge of the German language. It's 100% free, no registration required.Sign up to join this community
The first one is grammatical, the second one is an error often committed by native speakers of English because they translate word by word.
But German main clauses don't have invariant word order, instead they follow topological fields. In particular, the finite verb should occupy the second of the fields. Since the subclause occupies the first field, there is no more room for the subject to go in front of the verb, and the result, while understandable, sounds rather wrong.
Correct in terms of grammar and what sounds natural would, as others already pointed out, be
Während ich Gitarre spielte, klopfte jemand an die Tür.
However, there are various minor things to consider in addition.
The above sentence somehow is close to implying that the playing and the knocking are actions of equal continuation; which is technically possible; but practically improbable. Rather, the playing is a continuous activity, the knocking a short, one-off, with sudden onset. So, a more natural way to say this would be
Als ich gerade Gitarre spielte, klopfte jemand an die Tür.
Main difference is the use of als instead of während. Als is used to prepare the reader (or listener) to expect a sudden action, whereas während lets them expect a prolongated action. But these differences are not absolute. There is no hard rule that would prescribe to use the one or the other in certain situations. Therefore, I inserted an additional gerade to put focus on a certain, brief moment of the (otherwise prolongated) playing.
It is also important to mind that the use of klopfte instead of hat geklopft is characteristic for written narratives of some formal level such as short stories or novels where ativities are presented under a perspective sequence. In oral everyday communication this does practically not occur. Here, the hat geklopft, habe gespielt tense is much more common. For example:
Als ich Gitarre spielte, hat jemand an die Tür geklopft.
or (not very good style, but anyway in use):
Als ich Gitarre gespielt habe, hat jemand an die Tür geklopft.
Even more natural in oral communication:
Als ich grade am Gitarre Spielen war, hat plötzlich jemand an die Tür geklopft.
Als ich grade am Gitarre Spielen war, hat plötzlich wer an die Tür geklopft.
where the jemand is replaced by the informal (and a bit rude) wer.
Note however that this is natural German for oral use. If you write such sentences in a German language course, the teacher would probably fire red ink on you.