It all began about three years ago. Peter Shaffer, who has a special interest in odd events and obscure crannies of the human psyche, began to brood about the mysterious death and legend-shrouded funeral of Wolfgang Amadeus Mozart.

"The storm at Mozart's funeral was a 19th-centuy legend," says Shaffer, leaning over his table at New York's Backstage Restaurant and sipping a cup of coffee. "We know it was a legend because there was a dreary person in Vienna at the time named Count Zinzendorf who kept a diary and wrote down the weather for each day. He recorded no storm on the day of Mozart's funeral, and he seems reliable about weather -- more reliable than he was about music. He went to the premiere of 'Don Giovanni' and recorded that it was 'boring. He went to Handel's 'Messiah and wrote in his diary that it was 'a nightmare.'

"I began wondering why the legend had arisen that there was a storm at Mozart's funeral, and why the body was lost, and why [Mozart's rival, Austrian court-composer Antonio] Salieri was there. The legend that Mozart was poisoned by Salieri is well-known, of course; and if it had happened, it would have been hushed up. You can't have Hapsburg court officials murdering one another."

With half a dozen successful plays to his credit, including "Equus," "The Royal Hunt of the Sun," "Black Comedy" and "Five Finger Exercise," Shaffer at 54 enjoys the leisure to brood about mysterious events. "Equus" originated in a news story (told to him by a friend) about a boy who mutilated a horse.

"Amadeus," which opens Wednesday at the National, began with his reading about the death of Mozart. But that is now only a small part of the play, which spans the last 10 years of the composer's life to encompass an encounter between genius and mere talent, the thin line that divides admiration from jealousy, the jolitics of music in 18th-century Vienna, mankind's quarrel with God and the inability of society to find a place for its greatest members.

"Amadeus" has been a solid hit in London for more than a year, but when Shaffer sat down to talk about it in New York, that solidity had melted into enthusiasm for a new presentation. "This is the part of a production I like the best," he said, "when the words are becoming flesh. There's no more work to do on paper, but you are working with people, carving the play with the actors. The play has to go out into the world . . . No -- it has to go into them, the actors.

"At the beginning of rehearsals, the actors keep coming up to you and asking, 'I wonder if I could change this,' as though you are the repository of some kind of secret. Then, four weeks later, you go up to them and ask, 'I wonder if you could make these changes,' and they say, 'No! It's totally impossible -- he would never do that.' The character has taken over and is telling them what can and what cannot be done."

Shaffer is used to revisions, and has willingly changed about 10 percent of the script for the new production -- "not to make a new play of it," he insists, "but to make it more and more itself. I'm not changing it for America, but for itself and for myself. It's an enormous luxury, really. The nice thing about having a play that is a success in London is that you can watch it and have the courage to improve it. If it had been a flop, you couldn't do that."

Shaffer says that except for play-writting he has "a most boring life." He lives in New York but travels to England (where he was born) a lot. His interests are rchitecture and walking. He is "a bachelor and not about to marry."

"I regard myself as unemployable and dred the thought of having to work in an office again," he says. His musical background includes work at the English music publishers Boosey and Hawkes ("It was so long ago, I don't remember exactly what I did there. I looked over scores and helped to fill orders, but I never had the assignment of asking Benjamin Britten, for example, whether he really meant to use an E-flat in a particular passage."

He also worked (like an earlier British playwright, George Bernard Shaw) as a music critic for a British newspaper. "I took the job for precisely a year and only wrote two reviews per week -- one of a concert or recital and one of an oera. What I wanted to do was review performances of the standard repertoire as though they wre first nights, trying to evaluate what the composers had set out to do and whether they had done it. As a playwright, I found it fascinating to review opera. I kept asking myself: 'Is this really any good?' and I found that the world of opera was depressingly silly unless you looked behind it and discovered the human feelings that it's really about."

Musically he is "mostly self-taught, but I play the piano well enough to be able to stumble through the scores of Salieri's opera. I thought I should do that, because you can't hear them otherwise. Once you've played through them at the piano, you understand why you don't hear them otherwise."

Shaffer talks about Mozart with a kind of awe so complete it excludes envy: "It's very alarming, actually. It makes no sense in our terms. His first drafts look like final copies. That's the extraordinary thing about Mozart's music. It looks like it has been dictated."

Dictated by whom? In the play, Mozart's rival Salier (the court composer for Emperor Joseph II hears Mozart's music and concludes that the young comoser has a direct hot line to God. Salieri writhes in envy because he had thought that God was on his side. "It seemed to me that I had heard a voice of God -- and that it issued from a creature whose own voice I had also heard -- and it was the voice of an obscene child."

In "Amadeus," the composer is in fact an obscene child, a peasant bumpkin without tact or modesty or good taste -- one who woos his fiancee with obscenities and scatology, tells the groom of the Imperial Chamber to "lower your breeches" when he is asked to lower his voice, and insults Italian musicians while he is talking to that eminent Italian musician, Salieri: "Tell me, no offense intended, but why are Italians so scared of complexity in music? They really are the most simple-minded people in the world."

The amazing thing about Mozart's music, Shaffer believes, is not merely its quality, its abundance, or its complexity (which was a bit too much for the Vienese taste of his time), but above all that "it happens to a bouncy, little child-man with many failings. Not to the tortured artist who became one of the favorite legends of the Romantic era or to the porcelain child whom many people like to see in Mozart."

Schaffer's Mozart has, in fact, many of the qualities observed in a notable modern child prodigy, Bobby Fischer. There is the same lack of social amenities -- the arrogance of genius. This arrogance can be found in Mozart's letters -- particularly his letters to his father, a professional musician -- where he is both precise and merciless in his judgment of contemporaries. The scatology is in his letters, too -- particularly the letters sent to his sister when he was traveling as a child prodigy. In the later years, most of the letters are to his father, respectful and businesslike, or to friends from whom he is begging money. But occassionally in a letter to his wife there is a glimpse of the private Mozart near the end of his life, not incompatible with the earth Mozart of "Amadeus":

"If I were to tell you all the things I do with your portrait, I think that you would often laugh. For instance, when I take it out of its case, I say, 'Good-day, Stanzer! -- Good-day little rascal, pussy-wussy, little turned-up nose. . ."

Shaffer finds this Mozart more interesting and convincing than the more common legends, and thinks his portrait is supported by his research. "I spent a lot of time on what I call creative research," he says, "and what beg as an idle pleasure gradually turns into an obsession. I've read almost all the books on Mozart -- there are not all that many, compared to peple like Beethoven or Napoleon -- and then I spent a lot of time, right into the rehearsals, taking out references that would clutter and slow down the play. The audience has to get a lot of this material by osmosis, but you certainly couldn't write freely and dramatically on a subject like this if you hadn't done research.

"I think Mozart was a very unaffected person,demotic in his character and the quality of his speech, and that he would say exactly what he thought. He was not restricted in his expression -- you can find it in his letters."

Lately, Shaffer has been working a 14-hour day preparing "Amadeus" for its Washington opening, but he already has begun work on a new play that sounds like an emotional sequel, although it will be remote in time and place from 18th-century Vienna.

"As I see it now, it will be the story of the widow of a genius who has become a keeper of the sacred flame -- like the widows of Schoenberg or Berg, or like Constanze Mozart, who promote her late husband's fame and priced his manuscripts according to the amount of ink they contained, the number of notes. I think it will be set on a Greek island and the action will involve a literary critic who comes to investigate the work of her late husband. But right now what I have is a lot of images, and I don't know what they are. It would be nice if it were simple a matter of sharpening your quill and writing, the way Mozart did."