Besides, meagre as was his salary, he could save enough for a journey to Lübeck to hear Buxtehude, whom he had long desired to know; for while his brother Christoph had taught him Pachelbel's methods, Georg Böhm, of another school, had already impressed on him that dualism whence was born, when another element was added to it, his own originality. Receiving the favor of a leave of absence for one month, Bach betook himself from Arnstadt to Lübeck the last of October, 1705; he did not return until February, 1706. From this journey he brought back a new virtuosity and the susceptibility of a young artist who from that moment felt himself a master; the former singularly disappointed the parish. He now accompanied the chorale with Buxtehude's exaggerated freedom; the ears of the faithful could not follow such elaborations, and, still worse, their voices lost the clue, and the choir fell into confusion. Hence a scandal, and thereupon a reprimand from the vestry. Moreover, had not Bach singularly outstayed his leave of absence? And again, why should he now neglect his choir? Why no more "music"? and still other grievances. Stung to the quick, Bach answered them by thenceforth affecting the very excesses in accompaniment which had met with such opposition, and by leaving entirely to themselves his choristers, whose sottise and coarseness disgusted him. As to the rest, he explained nothing, but sought another place; more than a year passed in these troubles. Upon the death of G. Ahle, organist of the church of St. Blasius in Mühlhausen, he applied for this position; it fell to his lot as the result of a competition, and he entered upon his duties during the summer of 1707. The same year (October 17) he married his cousin, Maria Barbara Bach.

From a pecuniary point of view the situation was not bad,[201] but the organ was detestable. Bach gave himself no rest until he accomplished its restoration by the council; he himself drew up a scheme for this, which was found to be so practical that it was adopted. But scarcely had the work been commenced, when the Duke of Saxe-Weimar, Wilhelm Ernst, offered him the position of court organist (1708). Bach accepted; Mühlhausen was then the scene of sectarian dissensions, pietists and orthodox were in open strife, in which were lost the efforts of Bach to establish a "regular style of music wholly to the glory of God,"[202] as he himself said; to which, moreover, the pietists were by doctrine[203] opposed. An aggravating circumstance was that Frohne, the Oberintendant of the church of St. Blasius, was one of the most ardent disciples of Spener, the founder of the pietists' sect; and Bach had chosen, as godfather for his first child, Eilmar, pastor of the Church of the Blessed Virgin Mary, who was the defender of the older traditions, to which Bach was devotedly attached.

Bach spent nine years at Weimar; for him this period was the complement of his finished years of study, and was the most brilliant in his career as a virtuoso. He played at neighboring courts, and his reputation was sufficiently great to put to flight Marchand (who was called "le grand Marchand"), who had been invited in 1717 to meet him in a sort of musical tournament. Numerous cantatas, as well as some chamber music, date from this period. In fact, during the last years of his residence in Weimar, Bach had undertaken the duties, without the title, of director of chamber music to the court, in addition to his vocation as organist; succeeding the aged Drese, who was too old to fill the position effectively. Upon the death of the latter, late in 1716, Bach expected the appointment; but nothing came of it, and this lack of recognition caused him to accept the offer he received next year from the Prince of Anhalt-Cöthen.

At Cöthen there was no more organ playing to be done; no more church music to direct—the prince was a Calvinist. As to his duties, for which he had been well prepared by his recent experience at Weimar, Bach was content with the composition of most of the suites and sonatas for violin, viola da gamba, flute, and clavecin; further, the first part of the Well-tempered Clavichord dates from Cöthen. This is worthy of note, because of the relationship which can be established between certain organ works and some of those in this volume.

A life which might thenceforward have been so quiet, Bach being treated as a friend by his prince, and having no further care than the performance of music in an intimate manner, was in 1720 crossed by a sudden misfortune; upon his return from a journey to Carlsbad, Bach found his home desolate; his wife, Maria Barbara, was dead.

Despite his grief, Bach recovered himself in a comparatively short time, for in November of the same year he went to Hamburg to conduct the cantata Wer sich selbst erhöhet, der soll erniedriget werden; he drew from Adam Reinken, by his improvisations upon the organ, an outburst of enthusiasm which the old man had never entertained for anyone but himself.

Left alone with his children, who were still young, Bach lost no time in remarrying (December 3, 1721); this time a good musician, Anna Maria Wülken, who acted as his copyist, and for whom he wrote several pieces.

Upon the death of Kuhnau, cantor at St. Thomas' School in Leipzig (1722), Bach advanced his candidacy. He was not unknown in Leipzig, where enough confidence had been reposed in him to cause his summons as an expert, in 1717, to examine with Kuhnau the organ in the University Church.