On Thursday, the world will celebrate the 300th birthday of Johann Sebastian Bach, so much of whose music breathes an air of unearthly peace. Listen to his "Sheep May Safely Graze," for example, or the Air from his Third Suite for Orchestra, and you might think that his life was one of the purest calm and serenity -- at least as much serenity as an overworked father of 20 children could expect.

Consider, then, a less celebrated Bach anniversary (the 268th) that comes up near the end of the year: Nov. 6 is the day in 1717 when the great composer was thrown in jail.

Bach was imprisoned and kept there until Dec. 2, according to a Weimar court record, because he wanted a new job. Orphaned at 10 and self-supporting by the time he was 18, Bach spent a significant part of his adult life hunting for better jobs. He was turned down much more often than he was hired, and in late 1717 he learned that you do not quit the service of an 18th-century German nobleman until said nobleman is ready to let you go.

All the evidence indicates that his family life was harmonious. The Bachs were musicians for seven generations (in some German villages, the word "Bach" was used to mean "musician"), and Johann Sebastian, in the fifth generation, raised a fine crop for the late 18th century. He was proud of his family, and used to boast that he could recruit an orchestra and chorus in his own home.

But he was also a sort of public servant -- music then was largely a function of church and state -- and his work was less harmonious than his (hardly abundant) free time. Bach's public life is well documented in court records, church and school reports, letters, bills and receipts, memoirs of his acquaintances and the archives of several German city governments. From these old records, the life of Bach appears almost as turbulent and tragic as those of Mozart and Beethoven.

He may be the greatest composer of the three, though at that level such comparisons are meaningless. But he had to wait longer than the others -- long after the centennial of his birth -- for his genius to be recognized outside a small circle of connoisseurs, who included Mozart and Beethoven. Mozart made string transcriptions from several sections of "The Art of Fugue," composed preludes for them and wrote to his father that he had found music from which he could learn something. Beethoven first achieved wide recognition as a piano virtuoso, playing "The Well-Tempered Clavier." And at the end of his life, Bach was the only clear predecessor he had for some of the ideas in his late quartets. But otherwise, Bach's music was hardly known for nearly 80 years after his death.

Johann Nicolaus Forkel, in the first book-length biography of Bach, called him "the greatest musical poet and the greatest musical orator that ever existed, and probably ever will exist." That was in 1802, 11 years after Mozart's death, when Beethoven was about to unleash his "Eroica" Symphony on a startled world. Bach had been dead since 1750; his widow had died in extreme poverty in 1760; the four sons who had become notable composers were all in the grave. And even Forkel's biography did not win universal recognition for Bach.

That came finally in 1829, when Mendelssohn revived the "St. Matthew Passion" in Leipzig, where Bach had worked for the last 27 years of his life. Since then, there have been no limits to Bach's reputation; his influence can be seen in the work of every major composer from Chopin to Bartok, and it is probably stronger today than at any time in the past. Art and Life

Why was Bach's life so troubled and his posthumous reputation so insecure? Part of the composer's problem -- a substantial part -- was his own doing. Johann Sebastian Bach was a perfectionist. According to his son Carl Philip Emanuel, nobody else could tune his instruments to his satisfaction. His pupil J.P. Kirnberger said Bach would not tolerate being told that something was "impossible"; he "used to say, 'It must be possible to do everything.' " Along with his perfectionism, he had a choleric disposition, and he lacked the ability to suffer fools gladly.

For much of his adult life, Bach was surrounded by people whom he must have considered fools. He had to work with them and, worse, he had to work for them, to accept their judgments and satisfy their musical tastes. Sometimes he simply refused to do so. He was a firm believer in rules: rules of art and rules of life. He was also fully aware of his own worth. When the rules were not properly observed or the value of his art not properly recognized -- particularly when he thought his rights were being violated or the quality of his work was being undermined -- he was always ready to fight.

This pattern was established early. In Arnstadt, where he got his first job as an organist when he was 18, he had a public brawl (in which he drew his sword) with a bassoonist. The town's consistory advised him that he must learn to "live among imperfections."

Many of the documents of his life (more than half his surviving letters, for example) deal with controversies, usually between Bach and the bureaucrats of church and state. One reason may be that documents tend to be generated when there is conflict, while happy times go undocumented.

But another reason is that he was often embroiled in disputes. Centuries later, these disputes may seem petty. He fought with the subdeacon of St. Thomas Church in Leipzig over who should choose the hymns to be sung before and after the sermon, traditionally the cantor's right. He fought with the authorities at the Leipzig university over who should conduct Sunday services there, compose new music and collect the fees for this work -- again traditionally his prerogative.

He fought with the town council over the number of musicians made available for services. He auditioned candidates for his choir school, pronounced them unfit and saw them appointed despite his objections. He was engaged in constant battles over problems of discipline in the school and over his refusal to teach Latin as well as music. And Bach was not the first choice for the Leipzig cantor's job; he got it only because Georg Philipp Telemann and Christoph Graupner turned it down. Available documents show that Bach's clavier may have been well tempered but he was not.

But today the names of his Leipzig contemporaries are remembered, if at all, only because of their connection with Bach. So are the names of various members of the nobility who lorded it over him in his lifetime. Only in biographies of Bach does a general reader encounter the duke of Sachsen-Weissenfels, who refused to hire him as an organist; Duke Wilhelm-Ernst of Weimar, who had him imprisoned for "too obstinately requesting his dismissal"; or Christian Ludwig, Margrave of Brandenburg, to whom Bach dedicated his set of concertos.

To those who know the circumstances, the dedication of the "Brandenburg" Concertos makes particularly discouraging reading. It is written in the obsequious style commonly adopted for addressing potentates at that time. Bach recalls having played for the Margrave and noticing that he "took some pleasure in the small talent for music that Heaven has given me."

Then he offers the concertos, "very humbly" begging the Margrave "not to judge their imperfections rigorously by the fine and delicate taste in musical matters which all the world knows you possess." Between the lines, it appears that Bach was exploring the possibilities of a job. No job was forthcoming, and the Margrave apparently never bothered to have a performance of the "Brandenburg" Concertos -- the greatest orchestral music that had been written up to that time. Bach the Musician

The first thing to be said about Bach's music is that it is almost indestructible. It is currently fashionable (and, on the whole, a commendable fashion) to play his music on 18th-century rather than modern instruments with the pitch lowered about a half-tone.

But Bach's music can be performed effectively on instruments he never imagined. It has been arranged for Moog synthesizer, for the scat chorus of the Swingle Singers, for brass quintets and jazz ensembles, even for the humble harmonica, and it has retained its power. Leopold Stokowski arranged some of his organ music for a post-Rimsky-Korsakov orchestra with strange and wonderful results. Ferrucio Busoni transcribed his organ music for piano, adding even more virtuoso flourishes. Bach's harpsichord music has even taken on a new life, and revealed previously unguessed dimensions, on that strangest of all instruments, the Glenn Gould piano with hum obbligato.

The first one to transcribe Bach's music into new forms was, of course, Johann Sebastian Bach. He was a frequent self-plagiarist -- partly because of deadline pressures, but also because he was constantly trying to find better embodiments for some of his musical ideas. A list and summary discussion of his self-borrowings would fill a book -- and has. In "Bach the Borrower," Norman Carrell uses nearly 400 pages to trace, for example, the transformation of the Overture to Suite No. 4 for Orchestra into the choral introduction of a Christmas cantata.

For about half a century, since Wanda Landowska brought the harpsichord back to life, there has been a controversy about whether performances of Bach on the piano should be allowed. One short answer is that, whether or not this is good for Bach, it is certainly good for pianists. Another is that Bach's music should be played on any instrument that can handle the notes.

But there remains the stubborn fact that pianos, modern orchestras and jazz combos produce a kind of sound that Bach did not envision when he wrote the music. The piano, for example, has capacities for crescendos and sustained tones that were not available on the harpsichord, and when these are used the music is changed. It is not true, however, that Bach never saw or played a piano. In his later years, he actually advised a friend, the organ builder Gottfried Silbermann, on the design and construction of pianos. He even sold pianos for him; at least one bill of sale still exists.

But in general, it is illuminating to be able to hear Bach's music the way Bach himself heard it. The sonatas and partitas for unaccompanied violin, for example, become something quite different when they are played by Sergiu Luca on a Baroque violin -- less brilliant in tone, less difficult in passages requiring more than one note at a time, and more purely musical.

Similarly, the 20th-century voice (particularly an operatically trained voice) is quite different from what was heard in the St. Thomas Church in the 1720s -- more indiscriminate in the use of vibrato, for one thing. And in Bach's church the soprano and alto parts were sung by boys, not women.

In his lifetime, Bach was most respected as a performer on the organ -- like Mozart, he wrote music somewhat more elaborate and demanding than most people wanted. A former student, Johann Adolph Scheibe, wrote an anonymous article in 1737 (probably reflecting fairly common opinions) that praised him as a performer and condemned him as a composer. "One is amazed at his ability," he said, "and one can hardly conceive how it is possible for him to achieve such agility, with his finger and with his feet, in the crossings, extensions, and extreme jumps that he manages, without mixing in a single wrong tone . . ." But Bach's compositions, he said, were "turgid" and lacked "the natural element"; he "darkened" his music's beauty "by an excess of art."

Part of this critique is an index of changing tastes. During his lifetime, the Baroque style gradually went out of fashion, but Bach continued to work in a polyphonic style, with several lines of melody, all equally important, interwoven in a tight, homogeneous texture. Meanwhile, some composers were concentrating on a single melody with accompaniment; others (pointing toward Mozart and Beethoven) were beginning to find new depth in harmonic sequences, concentrating on music as a series of chordal structures.

Bach wrote this kind of music once or twice, and he trained his sons to use these styles in the next generation. But on the whole, he remained dedicated to the Baroque musical ideal -- his eye firmly fixed on the past. He knew that past (including the music of such early predecessors as Palestrina and Frescobaldi) better than most composers of his generation. And, consciously or not, he chose to be the culmination of the Baroque rather than the groundbreaker for new styles.

Chances are that he did not think of his music as a historic phenomenon; he produced music as needed (for teaching, for a religious service, a concert, a royal birthday), the way a carpenter produces shelves and cabinets. Composing for posterity was not yet fashionable in his lifetime, and he probably did not expect his unpublished compositions (which were practically all his works) to survive him. He was nevertheless his own severest critic, much tougher than any fancied posterity, and posterity has rewarded him (somewhat belatedly) for such integrity. Vanished Bach

His expectations that his music would perish with him were partly fulfilled. Well over 1,000 of his works have been preserved, and a majority are masterpieces. But nobody knows how much has been lost. His eldest son, Wilhelm Friedemann Bach, received many of his father's manuscripts after the elder Bach's death and later, in dire poverty, had to sell them to support himself. A few of these manuscripts have found their way safely into libraries; most are gone, presumably forever.

The recent discovery of 33 early organ chorale preludes, which will have their first modern performance today in New Haven, Conn. (and will be broadcast by WETA-FM at 3 p.m.), may give an inkling of what has disappeared. It is estimated that about 100 cantatas, some 40 percent of his output in this form, are lost. Nobody can give even an approximate figure on the losses among his orchestral and chamber works, but some of the originals can be traced through his reuse of the material in other forms.

All three of his surviving violin concertos exist in transcriptions for harpsichord, and most of his other harpsichord concertos are transcribed from lost originals for violin or oboe. Experts can find traces of the original instrument in solo passages that are not in his purest keyboard style, and recordings of the reconstructed originals are now available.

In his Cantata No. 194, there are several movements obviously transcribed for voices from a lost suite for orchestra in the French style. A lost instrumental concerto seems to have supplied the material for the "Et resurrexit" of the Mass in B Minor, and there are similar hints scattered throughout his work. Most of the lost orchestral and chamber music probably dates from the five years he spent at the court of Co then, when his duties did not include church music. On the whole, these were probably the happiest years of his adult life, but his work is not particularly abundant compared to the hectic early years in Leipzig. If the "Brandenburg" Concertos are a fair sample of what he was turning out at Co then, and if a substantial part has been lost, the loss is tragic.

But it is more profitable to concentrate on what is preserved than on what has been lost. With one exception, Bach made distinguished contributions to every form of mound in the late quartets of Beethoven -- is revealed in the "The Art of Fugue," the "Musical Offering" and the works for unaccompanied violin and unaccompanied cello. There is no other music like any of these works, and they continue to reveal new facets even after a lifetime of familiarity.

But the heart of Bach's art, reaching his greatest emotional depths and inspiring his most varied forms of expression, lies in his vocal music. The best known, and perhaps the greatest, are his two blockbusters, the Mass in B Minor and the "St. Matthew Passion," but Bach reveals himself most fully and communicated most intimately in his cantatas.

There are more than 200 of them, and every one has moments of magic, flashes of revelation. It is impossible to discuss them in any detail at less than book length, and (being essentially sermons in music) they are not a form particularly congenial to contemporary tastes. But the moments of power, subtlety, deep feeling and pure beauty in any random selection (let's say Nos. 12, 31, 38, 50, 51, 56, 60, 65, 82, 84, 110, 131, 140 and 147) include some of the finest music ever set down on paper.