Bach died at home, in his bedroom above the Thomasplatz. A week before his death on July 28, Bach’s condition had deteriorated quickly when he suffered a stroke, which was soon followed by fever; a pair of failed eye operations performed on him a few months earlier had left Bach blind.
It was first published posthumously in 1751, appended to the first edition of the Art of Fugue in order to make up for the incompleteness of the collections’s final contrapunctus.
The manuscript version of the deathbed chorale, a fragment, includes some improvements to the published readings. In the note which appeared on the reverse side oft he title-page of the first edition of the Art of Fugue, Emanuel claimed that shortly before his death his father had dictated the chorale extemporaneously to an unnamed scribe.
Although Bach’s devotees presented the deathbed chorale as an inspired, unpremeditated creation, neither the printed nor manuscript version of the piece could have been dictated extemporaneously, at least not in its entirety.
This chorale is in an expansion of the short setting of the chorale melody that appeared in Orgelbüchlein written nearly thirty years earlier to an alternate text Wenn wir in höchsten Nöthen sein. The deathbed chorale strips the original of its elaborate ornamentation and introduces lengthy contrapuntal interludes thematically based on the chorale melody itself. It was intricate counterpoint that had occupied Bach’s last musical reflections.
Bach did not compose the entire work in the last week of his life, but there is no reason to doubt that he was at work on an expanded version of the chorale while awaiting his death, perhaps even before the stroke he suffered on July 20th.