Bob Dorough, composer of many “Schoolhouse Rock!” tunes, had a jazz background. (Tom Copi/Michael Ochs Archives/Getty Images)

Bob Dorough, a pianist and singer who performed with jazz greats Charlie Parker and Miles Davis but was perhaps best known for his whimsical compositions for the animated video series “Schoolhouse Rock!,” died April 23 at his home in Mount Bethel, Pa. He was 94.

His wife, Sally Shanley Dorough, confirmed the death but did not cite a specific cause.

Before “Schoolhouse Rock!,” which first aired in 1973, Mr. Dorough (rhymes with “thorough”) had pieced together a modest career as a performer and songwriter. He was the music director for boxer Sugar Ray Robinson’s short-lived foray into show business in the 1950s and had made a few albums that were critical successes but didn’t sell.

Some of his early compositions, including “Devil May Care,” a vocalese version of Parker’s “Yardbird Suite” and the cynical Christmas song “Blue Xmas” — performed with Davis — became cult favorites among jazz fans. A tune he co-wrote in the early 1960s, “Comin’ Home Baby,” became a Top-40 hit for Mel Tormé.

But by the end of the decade, Mr. Dorough was finding it hard to make a living in jazz and was working as a producer with the pop band Spanky & Our Gang.

About the same time, an advertising executive, David McCall, had casually remarked that his children couldn’t learn their multiplication tables but knew all the words to songs by the Rolling Stones. He tried out various composers for an experimental project but got nowhere.

One of his business associates, George Newall, was a jazz buff who was talking over the idea with Ben Tucker, who was the co-composer of “Comin’ Home Baby.”

“Get Bob Dorough,” Tucker said, according to a 1998 story in Texas Monthly. “He can put anything to music!”

Mr. Dorough’s assignment was the number 3. His only instructions were that he shouldn’t “write down” to children but should compose the song with integrity.

“I just kept searching for an idea that would be far beyond the multiplication table,” Mr. Dorough told the Los Angeles Times in 1997, “and got the idea that three is the magical number. . . . I just got to thinking: Every triangle has three sides, the Trinity, man and woman had a little baby and it all fell together.”

Mr. Dorough’s version of “Three Is a Magic Number” debuted in 1973:

Somewhere in the ancient mystic trinity

You get three as a magic number

The past and the present and the future

The faith and hope and charity

The heart and the brain and the body

Give you three as a magic number

Mr. Dorough became the music director for “Schoolhouse Rock!,” as ABC shaved three minutes off its Saturday morning cartoons to accommodate the instructional music videos. He composed 11 songs about the multiplication tables, skipping 1 and 10 — but including “My Hero Zero.”

He moved on from mathematics to history, civics and parts of speech, including adverbs (“Slowly, surely, really learn your adverbs here”) and the lowly conjunction, which became the hero of “Conjunction Junction”:

Conjunction Junction, what’s your function?

Hooking up two boxcars and making ’em run right.

Milk and honey, bread and butter, peas and rice.

Hey that’s nice!

Mr. Dorough hired other composers to help with the project, which lasted through 1985, then was revived in the 1990s. He continued writing for “Schoolhouse Rock!” as recently as 2009 and often toured schools to perform the catchy, informative songs.

The songs became so popular that Mr. Dorough couldn’t give a jazz performance without receiving requests for “Schoolhouse Rock!” songs, and he happily obliged.

Robert Lrod Dorough — his middle name was pronounced “Elrod” — was born Dec. 12, 1923, in Cherry Hill, Ark., and grew up in rural Arkansas and Texas. His father was a salesman and delivery truck driver, his mother a homemaker.

An aunt pushed Mr. Dorough on stage at 4 to sing at a talent contest, and he soon began taking piano lessons. In his teens he was playing the clarinet and saxophone, and he first became exposed to jazz as a student at Texas Tech University.

He served in the Army during World War II, then studied at what is now the University of North Texas, concentrating on composing on piano. After graduating in 1949, he moved to New York, studied at Columbia University and began working as a pianist.

One of his part-time jobs was playing at a tap-dance studio, where one of the students was Robinson, the middleweight boxing champion. Robinson had show-business ambitions and hired Mr. Dorough as his musical director in 1953.

Mr. Dorough later worked in Paris for almost two years before moving back to New York. He later became one of the few singers to record with Davis. He went on jazz tours for the State Department and released albums well into his 80s. He gave his final performance on March 31.

His first marriage, to Jacqueline Wright, ended in divorce. His second wife, the former Corine Oeser, died in 1986.

Survivors include his wife of 25 years, the former Sally Shanley of Mount Bethel; a daughter from his second marriage, Aralee Dorough, the principal flutist of the Houston Symphony; two stepsons, Christopher Wolf of Cortez, Colo., and Peter Wolf of Glastonbury, Conn.; a brother; and seven grandchildren.

As a vocalist, Mr. Dorough had a reedy voice with a distinctive twang that resembled the stylings of Hoagy Carmichael or Mose Allison. Yet he had clean diction and a sure sense of rhythm that made his finest works effective, whether he was striving for humor or poignancy or, with his “Schoolhouse Rock” songs, instruction.

“His work is happy and humorous and swinging,” singer Annie Ross told the Los Angeles Times in 1997. “Jazz is a happy music, and Bob Dorough makes it that way.”

An earlier version of this story incorrectly stated that Jack Sheldon sang “Three Is a Magic Number.”