Stanley Cavell was an influential philosopher at Harvard University. (Jane Reed/Harvard University)

Stanley Cavell, a onetime jazz pianist who traded music for philosophy but maintained an abiding interest in the arts, mining screwball comedies, Shakespearean dramas and postwar “new music” for philosophical insights, died June 19 at a hospital in Boston. He was 91 and had suffered a heart attack, said his son David Cavell.

Dr. Cavell (pronounced kuh-VELL) taught at Harvard University for more than three decades but was often treated as something of an outsider, alternately scorned and celebrated by colleagues who noted that his books strayed far from the confines of traditional philosophy.

“Cavell is among professors of philosophy what Harold Bloom is among the professors of English: the least defended, the gutsiest, the most vulnerable. He sticks his neck out farther than any of the rest of us,” philosopher Richard Rorty once wrote in the New Republic.

While other scholars devoted decades to the subtleties of Aristotle or the intricacies of Kant, Dr. Cavell’s work encompassed a study of self-deception in “King Lear,” commentaries on the Vienna-born philosopher Ludwig Wittgenstein and examinations of the links between Emerson and “The Philadelphia Story,” John Locke and “Adam’s Rib.”

A student of J.L. Austin, who sought to resolve philosophical problems by using “ordinary language” in place of academic jargon, Dr. Cavell made major contributions to the philosophy of language as well as to ethics, aesthetics and epistemology, the branch of philosophy that addresses knowledge and belief.

His first book, the 1969 essay collection “Must We Mean What We Say?,” is now considered a modern classic, acclaimed for its vivid prose style and for bridging the continental tradition of philosophers such as Kierkegaard and Heidegger with the analytic tradition of Austin and Wittgenstein.

For much of his career, Dr. Cavell focused on philosophical skepticism, following Descartes and others in asking how we know whether the world is real, or how we might ever truly know another person.

In effect, said Paul Guyer, a Brown University professor of humanities and philosophy, Dr. Cavell came to believe that such certainty was unattainable.

“It’s a mistake to think that skepticism is a purely philosophical problem that can be resolved with some kind of philosophical argument,” he said in a phone interview. “Rather, we have to know that the inability to know everything about the feelings and intentions of other people, or even what our own feelings and intentions are, is a fact of human life.”

“You have to have a certain kind of trust in people,” he added, summarizing the views of his former teacher, “and if you don’t, you’re going to end up making a mess.”

To illustrate his philosophical beliefs, including an ethical stance he dubbed “Emersonian perfectionism,” Dr. Cavell turned to Shakespeare as well as cinema, drawing examples from some of the screwball comedies he watched in the 1940s while playing hooky from composition classes at Juilliard.

He had been a cinephile since he was a young man and for years watched two or more movies each night, never considering their use as a philosophical subject until he saw an Ingmar Bergman comedy while working toward his doctorate.

“I went back to my pathetic digs and wrote about ‘Smiles of a Summer Night’ all night long, when I should have been trying to add a couple of pages to my dissertation,” he told an interviewer with the University of California at Berkeley’s “Conversations With History” series. “But it wouldn’t leave me alone.”

Dr. Cavell went on to write several books about movies, beginning with “The World Viewed: Reflections on the Ontology of Film” (1971). At the time, film studies scarcely existed as an academic discipline; writing about movies, he said, “caused me a certain amount of grief.”

“But what’s kept me going,” he added, “was the sense that it was not a question of why I was interested in film, but a question of why, since everyone is interested in film (one supposes throughout the world), why don’t philosophers write about it? That was the question that, perhaps, more than anything, puzzled, bothered, even provoked me.”

Stanley Louis Goldstein was born in Atlanta on Sept. 1, 1926. His mother was the daughter of Jewish immigrants from Romania and played the piano at vaudeville shows and silent movies; his father was born in Poland and worked as a watchmaker, operating pawnshops and a jewelry business that collapsed during the Depression.

The family shuttled between the coasts for several years, seeking better fortunes with an uncle who lived in Sacramento, where Dr. Cavell graduated from high school. A precocious student, he skipped several grades and enrolled at UC-Berkeley at 16, paying his tuition using money he earned from playing in a jazz band.

He had by then changed his name, Anglicizing his family’s original Polish name of Kavelieruskii (sometimes spelled Kavelieriskii), and in 1947 received a bachelor’s degree in music.

Dr. Cavell briefly attended the Juilliard School in Manhattan before deciding that, in his early 20s, he was too old to train as a composer. He moved back west and began taking classes at the University of California at Los Angeles, in psychology and then philosophy.

“I was bewildered by who I might be if I wasn’t a musician,” he said in the UC-Berkeley interview. “And philosophy is, after all, a subject you might come to in a state of crisis. But I found in philosophy something that not just answered the sense of crisis, but that in some way seemed to me the continuation of what I wanted from music, in its precision and in its profundity.”

Dr. Cavell finished his studies at Harvard, where he received his doctorate in 1961 and joined the faculty two years later. He became active in civil rights efforts on campus and, in 1964, traveled to historically black Tougaloo College in Mississippi, where he taught and participated in the Freedom Summer voting rights effort.

He later aided a student-led campaign to create an African American studies department at Harvard and co-founded the Harvard Film Archive.

Dr. Cavell became a professor emeritus in 1997 and was a former president of the American Philosophical Association. His recent books included “Cities of Words” (2004), which paired chapters on philosophers with chapters on films, and “Little Did I Know” (2010), a memoir.

His marriage to Marcia Schmid ended in divorce. Survivors include his wife of 51 years, the former Cathleen Cohen of Brookline, Mass.; a daughter from his first marriage, Rachel Cavell of Rhinebeck, N.Y.; two sons from his second marriage, David Cavell of Cambridge, Mass., and Benjamin Cavell of Santa Monica, Calif.; and five grandchildren.

In the essay collection “Themes Out of School” (1984), Dr. Cavell offered a definition of philosophy, characterizing it as a way in which people “learn to think undistractedly about things that ordinary human beings cannot help thinking about, or anyway cannot help having occur to them, sometimes in fantasy, sometimes as a flash across a landscape.”

Such thoughts often took the form of questions, he noted, that suggested no easy answers — perhaps no answers at all. “Philosophers after my own heart,” he continued, provide a certain consolation, conveying “that while there may be no satisfying answers to such questions in certain forms, there are, so to speak, directions to answers, ways to think, that are worth the time of your life to discover.”