quality:corruption, structural:expansion
Return to Weimar (1708–1717)

Bach left Mühlhausen in 1708, returning to Weimar this time as organist and from 1714 Konzertmeister (director of music) at the ducal court, where he had an opportunity to work with a large, well-funded contingent of professional musicians. Bach and his wife moved into a house near the ducal palace. Later the same year, their first child, Catharina Dorothea, was born, and Maria Barbara's elder, unmarried sister joined them. She remained to help run the household until she died in 1729. Three sons were also born in Weimar: Wilhelm Friedemann, Carl Philipp Emanuel, and Johann Gottfried Bernhard. Johann Sebastian and Maria Barbara had three more children – twins born in 1713 and a single birth; none survived until their first birthday.

Bach's time in Weimar began a sustained period of composing keyboard and orchestral works. He attained the proficiency and confidence to extend the prevailing structures and include influences from abroad. He learned to write dramatic openings and employ the dynamic rhythms and harmonic schemes found in the music of Italians such as Vivaldi, Corelli, and Torelli. Bach absorbed these stylistic aspects to a certain extent by transcribing Vivaldi's string and wind concertos for harpsichord and organ; many of these transcribed works are still regularly performed. Bach was particularly attracted to the Italian style, in which one or more solo instruments alternate section-by-section with the full orchestra throughout a movement.

In Weimar, Bach continued to play and compose for the organ and perform concert music with the duke's ensemble. He also began to write the preludes and fugues which were later assembled into his monumental work The Well-Tempered Clavier ("clavier" meaning clavichord or harpsichord), consisting of two books, each containing 24 preludes and fugues in every major and minor key. Bach also started work on the Little Organ Book in Weimar, containing traditional Lutheran chorale tunes set in complex textures. In 1713, Bach was offered a post in Halle when he advised the authorities during a renovation by Christoph Cuntzius of the main organ in the west gallery of the Market Church of Our Dear Lady.

In the spring of 1714, Bach was promoted to Konzertmeister, an honour that entailed performing a church cantata monthly in the castle church. The first three cantatas in the new series Bach composed in Weimar were Himmelskönig, sei willkommen, BWV 182, for Palm Sunday, which coincided with the Annunciation that year; Weinen, Klagen, Sorgen, Zagen, BWV 12, for Jubilate Sunday; and Erschallet, ihr Lieder, erklinget, ihr Saiten! BWV 172 for Pentecost. Bach's first Christmas cantata, Christen, ätzet diesen Tag, BWV 63, premiered in 1714 or 1715.

In 1717, Bach eventually fell out of favour in Weimar and, according to a translation of the court secretary's report, was jailed for almost a month before being unfavourably dismissed: "On November 6,, the quondam concertmaster and organist Bach was confined to the County Judge's place of detention for too stubbornly forcing the issue of his dismissal and finally on December 2 was freed from arrest with notice of his unfavourable discharge."