Danny Elfman wasn’t the first rock ‘n’ roller to become a film composer, and he certainly won’t be the last. While he endured more flak than almost anyone in the history of the profession — in part because he made no secret of the fact that he was self-taught — the early, often unwarranted criticism by the old guard of Hollywood music makers has largely abated.

Despite Grammy and Emmy wins, and three Oscar nominations, the former Oingo Boingo frontman remains an iconoclast. But over 21 years and more than 50 films, Elfman’s independent spirit and unusual work methods are now an asset, not a liability. Tim Burton won’t make a film without him; Gus Van Sant, Sam Raimi and Brett Ratner employ him regularly; and helmers like Brian De Palma and Ang Lee have asked him to come in and rescue their films when earlier scores weren’t working out.

“He doesn’t just hand in the score, he wants you to sit down and listen to two, three or four (musical) choices,” says Van Sant, whose “Good Will Hunting” and “To Die For” were embellished by Elfman’s music. “He really wants you to say, ‘I want direction B, not direction A.’ It gives him a way to be in touch with you as the director.”

It’s never easy, the 53-year-old composer concedes. “There is a big jigsaw puzzle that takes place in the creation of a score,” Elfman says. “It’s very mathematically connected, but I don’t understand it, and I don’t try to force it.

“I can’t start a score until I have the biggest pieces of the puzzle completely laid out. I have to know what all my themes are, and I have to know that if I’m going to ask this theme to get melancholy, it will, and if I have to ask it to get heroic, it will.”

Ratner remembers being surprised not only that Elfman agreed to score “The Family Man” in 2000, but that he worked out the critical last scene first. “I’m not a master storyteller,” Ratner says, “but Danny enhanced the scene. He knew exactly how to make the audience feel what I was trying to accomplish without making it overly sentimental or corny.

“A lot of the new composers just cover the images with music,” adds Ratner. “Danny reminds me of the old-school composers who used leitmotifs, the repetition of themes in various ways.”

Elfman’s eclectic musical tastes clearly helped to mold his unique style. He raves about Bernard Herrmann’s romantic “The Ghost and Mrs. Muir,” but he also was so obsessed by Duke Ellington’s music that he hand-transcribed the jazz great’s “Black and Tan Fantasy” to understand its structure and harmonies.

“I’m happy to be writing as an archaic throwback to early 20th century music. My inspirations primarily come from the 1920s to the 1940s,” he says, citing not only Ellington, Cab Calloway and Django Reinhardt, but also such Russian classical composers as Dmitri Shostakovich and Sergei Prokofiev (both of whom, not so coincidentally, also wrote film music).

Elfman’s early reputation for the musical whimsy behind “Pee-wee’s Big Adventure” and “Beetlejuice” soon was overshadowed by his large-scale orchestral scores for comicbook epics like “Batman,” “Darkman” and “Dick Tracy.”

Creating a symphonic score is a complex task, and it took Elfman years of study, “learning everything, teaching myself to write,” he says. He insists he wasn’t bothered by the initial lack of respect from the hardcore traditionalists who were convinced he was a “hummer,” letting his orchestrators do the real work. “All I ever wanted credit for was that 16 hours a day I was putting in. I’ve worked really hard, at a handicap.”

Raimi figured Elfman could write anything after he delivered the music for “Darkman.” For the unsettling “A Simple Plan,” Raimi recalled Elfman’s promise: “I’m going to give you a very icy sound. You’re going to feel the snow in this picture, the cold that’s crept into these people’s hearts.”

“It really was chilling,” Raimi says. “It pulled the movie together and gave it a soul that it didn’t quite have before.”

Finding that signature sound for every movie is still the most difficult — and yet paradoxically the most fun — aspect of the job, says Elfman. “The process I enjoy most is when I’ve finally captured the tone of the movie. Getting to that point is gutwrenching every time. It always feels like dipping a bucket down into a well and not knowing if you’re going to hear a splash. There’s an element of discovery and surprise there.”

And if it’s exciting for the composer, it can be a relief, and even a revelation, for the director. On “Spider-Man,” Raimi needed a composer “to really understand the character of Peter Parker, get into his head and understand his heart, and sing it to the audience through the score.

“Danny found the character. It was a very simple theme, but it had a quiet nobility to it, like Peter does, without sounding proud. There was a somberness to it, a little bit of melancholy, which was exactly right. And when I heard his love theme, I heard a longing, yet something that was incomplete. His music has gotten richer and richer, more complex and more subtle. He’s a world-class composer.”