Seth MacFarlane loves a good dare.

Directing, co-writing, producing and starring in his latest movie, a comedy Western called “A Million Ways to Die in the West” while juggling the production of four primetime series during the past year wasn’t enough for the multihyphenate. So he also taught himself how to play an exotic instrument to contribute to the film’s score.

When MacFarlane turned 40 last October, composer Joel McNeely presented him with a melodica, a mini keyboard attached to a mouthpiece that makes a sound similar to a harmonica. Attached was a note that read: “If there’s a hair on your ass, you’ll be playing this on the score, so start practicing.”

SEE ALSO: Starz Gives 20-Episode Order to Seth MacFarlane-Patrick Stewart Comedy ‘Blunt Talk’

McNeely thought the gift was mostly a joke. He’d hunted down the instrument after MacFarlane asked about a sound that intrigued him on the score of the 1962 epic “How the West Was Won.” “I thought he’d get a laugh out of it and put it in the closet, but I’ll be damned if he didn’t learn how to play it really really well,” McNeely says.

Tackling a new instrument at a time when he was already taking another big leap in his decidedly unconventional career — his first major live-action film role in Universal’s “A Million Ways” — is textbook MacFarlane. Friends and colleagues say the filmmaker, who launched his first animated comedy series, Fox’s “Family Guy,” before his 25th birthday, is driven by an enviable mix of raw talent and restless curiosity that keeps him always looking for what’s next. That explains how he managed to write a novel based on the “Million Ways” screenplay in his spare time during the film shoot last summer in New Mexico.

“The book was partially something to do on the weekends, because there’s nothing to do in Santa Fe except meth, and I am too afraid to do meth,” MacFarlane says. Ballantine released the 211-page book in early March, ahead of the film’s May 30 opening.

“A Million Ways” will be a test of MacFarlane’s ambition to expand his work as actor. For a writer-producer, he already enjoys a high profile with his core audience of young men, thanks to the renown he generated early on with “Family Guy.” The toon famously was canceled only to be reborn two years later as a bigger, better and fabulously profitable property for Fox and 20th Century Fox TV.

MacFarlane hosted the Oscars in 2013 — to mixed reviews — and continues to channel his inner Frank Sinatra with concert performances and recordings of American standards. (His second, as-yet unnamed holiday-themed album will be released this fall.) He made a big leap in 2012 into features, with the raunchy offbeat hit “Ted,” starring Mark Wahlberg and a foul-mouthed talking teddy bear voiced by MacFarlane.

All of this has made him rich — his indulgences include having built a $1 million Imax theater in the basement of his gated Beverly Hills house — and highly sought after. MacFarlane’s unorthodox approach to comedy resonates with young males, the prized demographic for both feature films and TV viewers. His milieu is a mix of scatological sophomoric material (his Twitter profile describes him as a “dysentery enthusiast”) and twisted bookish jokes. Even he struggles to define what it is about the Seth MacFarlane “brand” that propelled him so far so fast.

“I like the fact that I haven’t shoehorned myself into one M.O.,” he tells Variety. “I like that ‘Family Guy’ and ‘Cosmos’ exist at the same time. It makes things fun.”

The level of clout he wields on the Fox lot was demonstrated this year by the company’s embrace of MacFarlane’s passion project “Cosmos: A Spacetime Odyssey,” an update of physicist Carl Sagan’s landmark 1980 PBS series “Cosmos: A Personal Journey.” Only MacFarlane’s enthusiasm for the project could have persuaded the 21st Century Fox conglom to devote 13 hours of prime Sunday real estate on Fox to a documentary series hosted by astrophysicist Neil deGrasse Tyson.

MacFarlane’s SWAT team of reps at WME and Jackoway Tyerman are in the midst of negotiating a new megabucks overall deal with 20th Century Fox TV.

On the film side, since “Ted” made him red-hot, he intends to remain a free agent. He’s worked with Media Rights Capital on the R-rated comedy and its upcoming sequel, as well as on “A Million Ways,” but the relationship remains on a project-by-project basis.

Friends and associates say one way that MacFarlane has built his empire is simply by inserting himself into every step of the creative process. Scott Stuber, MacFarlane’s producing partner on “Ted,” noted that his feverish attention to detail extended all the way from the shape of a teddy bear’s nose to the lush music to getting just the right balance of high and low humor.

“He’s in total creative control of what he does,” says Wahlberg, who’s set to reprise his role in “Ted 2.” “He could be a dick about it, but he’s cool. He creates a loose environment for creative people to succeed that is conducive to being able to take risks. You could let all your shit go and look fucking ridiculous because you knew you were going to be protected.”

The concept for “A Million Ways” began as an inside joke between MacFarlane, Alec Sulkin and Wellesley Wild, his co-writers for more than a decade on “Family Guy” and “Ted.” The joke expanded, and the trio found themselves riffing on the idea of how dull, depressing and dangerous it must have been to live in the Wild West. The movie revolves around MacFarlane’s character, a sheep farmer in 1882 Arizona with a broken heart who manages to irritate the meanest outlaw in the land. Charlize Theron, Liam Neeson, Neil Patrick Harris and Amanda Seyfried also star.

As is MacFarlane’s tendency, he began researching the time period … and stumbled upon Jeff Guinn’s nonfiction novel, “The Last Gunfight: The Real Story of the Shootout at the O.K. Corral — And How It Changed the American West.” The book became an invaluable resource, says MacFarlane, and the basis of several ways of dying in the film.

MacFarlane is well aware of the risks at stake with “A Million Ways.” Beyond the issue of whether he can carry a movie as a live-action actor, the last time a comedy Western hit big at the B.O. was “Blazing Saddles,” which came out in 1974, the year after he was born.

“A comedy Western is not necessarily, from a historical standpoint, the most reliable genre to work in,” MacFarlane allows. The $40 million film endured a difficult shoot delayed by weather problems — everything from hailstorms to blistering heat to arctic winds and torrential rainstorms. But Universal didn’t balk.

“We’re looking at him as somebody operating at the top of his game and as somebody worth us betting on,” says Universal chairman Donna Langley.

With so much happening, MacFarlane has had to learn how to build some down time into his schedule. He was rushed to the hospital from the Fox lot in 2007 after working 15 months without a break. His love of music is a big help, and having the means to indulge his passions doesn’t hurt either.

When he’s not working, MacFarlane says he plays his Bosendorfer piano to relax. He drives a Tesla and owns a replica of the DeLorean Michael J. Fox drove in “Back to the Future.” He’s a staunch advocate of science and education, and sits on the board of the National Academy of Science’s Science & Entertainment Exchange.

To celebrate his 40th birthday, he threw himself a days-long party and, for a private performance at UCLA’s Royce Hall attended by 1,800 guests, flew in Britain’s famed John Wilson Orchestra. For a holiday party last year at his home, the Connecticut native had snow and ice trucked in to complete the winter-wonderland theme. As with all MacFarlane bashes, the gathering included entertainment by an industrial-strength (65-piece) orchestra.

“I came to expect that was a normal Hollywood party,” says “Cosmos” host Tyson.

Like most Hollywood hyphenates his age, MacFarlane’s standard workday uniform is jeans, T-shirt, sneakers (laceless Chuck Taylors) and a baseball cap. And he’s been known to indulge in the occasional spray tan. “If you are a pasty white guy, every once in a while it’s recommended to you,” he jokes.

In casual conversation, he is nothing like the stereotype of the comedian who can’t stop delivering one-liners.

“We would fly all the time together back and forth from L.A. to Santa Fe, and he’d have his headphones on reading his book (and) wouldn’t say anything for an hour,” says “A Million Ways” co-star Theron. “It’s so refreshing to not have someone constantly walking around with a drum set going ‘bad dum bum.’ ” But then, she adds, he’d pick up on something going on around him out of left field and toss off a comment that floored anyone nearby.

In an effort to bring more sanity to his daily grind, MacFarlane last September purchased a 20,000 square foot, three-story office building in Beverly Hills for roughly $11 million. In the biz, it was seen as a sign of him cementing his status as a mini-mogul. MacFarlane gives a more practical explanation.

“It became a necessity because Alec and Wellesley did a lot of writing at my house,” MacFarlane says, “and when writers leave your house, it’s a mess.”

About 15 people are working on various projects in the space, which will undergo a major remodel in the summer, once “Ted 2” goes into production.

Beverly Hills is a long way from the log cabin in Kent, Conn. where MacFarlane’s family lived in 1973, when Seth was born. His parents, Ron and Perry, had met in a health food store in 1969. His father worked as a butcher and a teacher (perhaps inspiring Seth’s own wild range of aptitudes); his mother was an admissions officer for the upscale Kent School that MacFarlane attended. He claims that his middle name ­— Woodbury ­­— is an homage to the town drunk from a bygone era.

“Every other male on my mom’s side of the family has that middle name; it started in 1904 with my grandfather when Woodbury was alive,” he says. “At least it’s an old fashioned, top-hat-with-a-patch-on-it, dirty-overcoat, fancy-shoes-with-the-toes-open, charming turn-of-the-century drunk, and not a modern-day wife-beating drunk, although who the hell knows what was going on then.”

MacFarlane began drawing at a young age, and by the time he was 8, he had a weekly cartoon in the local paper, the Kent Good Times Dispatch. The cartoon followed the travails of Walter Crouton, a newscaster. “Although I don’t ever recall him delivering the news anywhere in any of the comics,” MacFarlane says.

At the Kent School, he often found himself clashing with other students over the class divide and political ideologies. During his senior year, he won the school’s highest art prize, and went on to the Rhode Island School of Design.

Living in Providence, MacFarlane began doing standup comedy, and by his senior year had conceived what would eventually become “Family Guy”: In 1995, his 10-minute thesis film, “The Life of Larry,” an animated short that features a slovenly protagonist, his son and a talking dog, was sent to Hanna-Barbera by his professor, and won him a job offer from the studio, which by then was part of Ted Turner’s empire.

Working on “Johnny Bravo” and “Cow and Chicken,” MacFarlane proved to be a solid animator, but continued to develop his own characters off the clock. In 1997, an executive at Hanna-Barbera arranged a meeting for him at Fox. Mike Darnell, then head of alternative programming, was impressed and offered him $50,000 to develop a prototype for “Family Guy” — a seven-minute reel that MacFarlane wrote, directed, voiced and animated entirely by himself.

“He was just this sweet, eager, nervous, nerdy, enthusiastic young guy who was almost giddy with excitement that (‘Family Guy’) was going to come to life,” 20th Century Fox TV chairman-CEO Gary Newman recalls.

The toon got a huge send-off, bowing after Fox’s telecast of the 1999 Super Bowl.

The low point in MacFarlane’s career trajectory to date came in 2002, when Fox canceled “Family Guy.” But he never stopped pushing studio and network execs to revive the series. In a move of inspired desperation, Fox’s syndication arm gave the 50-odd existing episodes to Adult Swim for rerun airings, at a license fee so low they were virtually free. As the reruns built an audience on the cabler, and DVD sales of the first two seasons spiked, Adult Swim ordered new episodes from 20th TV. At which point the Fox network stepped in with a mea culpa and reclaimed the show. “Family Guy” has since blossomed into a $1 billion-plus franchise, thanks in part to robust ancillary products that include everything from T-shirts and plush toys to videogames and mobile apps.

Bucking all the odds against a canceled show leading him to prominence and prosperity is in keeping with MacFarlane’s charmed narrative. The experience taught him to seek out projects that “terrify” him, he says. So what’s next?

He’s performing with one of his idols, conductor John Williams, at the Hollywood Bowl this summer. He’d wants to author another novel, “one from scratch.” And attention CBS and Paramount: At some point he’d like to write and exec produce the next “Star Trek” television series. “I loved the show growing up,” he says. “I thought it was a wonderfully intelligent allegorical piece of television.”

There’s no formal talk of Seth boarding the Enterprise any time soon, but of late, MacFarlane has had to bear the weight of his dreams coming true. Still, despite his TV shows, movies, Beverly Hills building and startling collection of hyphens, he doesn’t see himself as an entertainment potentate. At least not this year.

“I’m not a mogul. Not yet,” MacFarlane says. “I think Jeffrey Katzenberg is a mogul. I’m just a guy with a bunch of shit going on.”

Cynthia Littleton contributed to this report.