There is a scene in a famous wartime film where a man sits at a piano in a dimly lit café and begins to play a melody that feels, somehow, like it has always existed. The room shifts. Conversation softens. Two people who should have moved on from each other are suddenly, painfully, right back where they started.
Most people who love that melody assume the song was born in that café, written for that moment, created specifically to make that film feel the way it does. Most people are wrong.
The song is “As Time Goes By,” performed by Dooley Wilson in the 1942 film Casablanca — but by the time the cameras rolled in Hollywood, the melody had already been living in the world for more than a decade.
The Piano Scene Movie Audiences Never Forgot
When Casablanca was released in November 1942, the world was deep in the second year of American involvement in World War II. The film arrived at exactly the right moment — a story of sacrifice, lost love, and moral clarity set against the backdrop of a world being torn apart. Audiences did not simply watch it. They felt it.
At the center of the film’s emotional core was a Black musician named Sam, played by Dooley Wilson. Wilson was a singer and actor, not primarily a pianist — the piano you hear in the film was actually dubbed by a studio musician — but what Wilson brought to the screen was something no session player could replicate. His warmth, his tenderness, and the quiet gravity he carried in every frame made Sam one of the most memorable supporting characters in Hollywood history.
The moment Ilsa Lund, played by Ingrid Bergman, asks Sam to play “their song,” the film crosses from a wartime thriller into something more personal and universal. The melody fills the café. Humphrey Bogart’s Rick Blaine appears. And for generations of moviegoers, that song became permanently fused with cigarette smoke, ceiling fans, and a love story that could not survive the weight of history.
For most of those viewers, the melody felt like it had been written for exactly that room, that moment, those two people. It had not.
The 1931 Broadway Musical Where It Began
“As Time Goes By” was written by Herman Hupfeld, an American songwriter who enjoyed a productive career contributing to Broadway revues and musical productions during the late 1920s and early 1930s. Hupfeld composed the song for a Broadway musical called Everybody’s Welcome, which opened in New York in 1931 — eleven years before Casablanca made it famous.
The show itself was a modest production, not one of Broadway’s legendary runs, and while “As Time Goes By” was performed during the show’s run, it did not ignite the world the way a great song sometimes does on first hearing. It was recorded and performed in the early 1930s, finding modest attention before largely settling into the background of popular music, the way many songs from that era eventually did.
Hupfeld’s melody had a particular quality that made it easy to hold onto — unhurried, slightly wistful, built on the kind of timeless sentiment that did not depend on a specific year or fashion to feel relevant. The song’s central idea, that the world keeps changing while certain fundamental things about human emotion remain constant, was not a lyric that aged. It was a philosophy.
When music supervisor and producer Hal Wallis and the team behind Casablanca were developing the screenplay based on the unproduced stage play Everybody Comes to Rick’s, the inclusion of “As Time Goes By” was written into the script. It was not selected at random. The song was a deliberate choice, one that came with its own modest history already attached. What nobody predicted was what the film would do to that history.
How Casablanca Gave the Song a New Identity
There is a well-known story about what almost happened to “As Time Goes By” after filming was completed. Producer Hal Wallis reportedly wanted to replace the song with a new composition after principal photography wrapped. The reason the song survived in its original place — and the reason you know it today — is that a change in Ingrid Bergman’s hairstyle for her next film made reshooting the café scenes impossible. The scene stayed. The song stayed.
Whether every detail of that story has been fully documented to archival certainty is something film historians continue to discuss, but the broad outline has been widely reported and does not change the essential fact: by the time Casablanca reached audiences, “As Time Goes By” had become something it was not in 1931. It had become the emotional center of one of the most celebrated films ever made.
After the film’s release, Rudy Vallée re-recorded the song, which had first been commercially recorded years earlier. The renewed attention turned “As Time Goes By” into a genuine popular standard almost overnight. Herman Hupfeld, who had written the song more than a decade before Hollywood transformed its meaning, suddenly found his quiet Broadway number on the lips of a generation who had no idea it had a life before the film.
The Famous Line People Often Misquote
Few moments in cinema history have been misquoted as consistently and affectionately as the line connected to this song. Across decades of impressions, parodies, and casual references, the phrase “Play it again, Sam” has become one of the most recognized lines in film history — except that nobody in Casablanca actually says it.
What Ilsa says, in the scene where she approaches Sam at the piano, is closer to a gentle request that he play the song — not that precise four-word phrase the world has been repeating ever since. Rick’s own reference to the song later in the film is similarly different from the famous misquote. The phrase “Play it again, Sam” does not appear in the screenplay.
This is one of cinema’s most enduring small legends — a line so perfectly suited to the scene that audiences constructed it from memory and passed it on as fact. Woody Allen even named a 1972 film after the misquote, cementing its place in popular culture permanently. The actual dialogue, for anyone who watches the film carefully, tells a slightly different story. But the misquote has its own life now, one the film itself never quite managed to correct.
In a way, the misquote mirrors the song’s own history. Just as “As Time Goes By” became permanently associated with a film rather than its Broadway origin, the line became permanently associated with a phrasing that the film never used. Memory reshapes things. Sometimes the reshaping sticks.
A Standard That Continued Long After the Film
Herman Hupfeld died in 1951, less than a decade after Casablanca turned his quiet 1931 composition into one of the most recognized melodies of the twentieth century. He lived long enough to see his song transformed, but perhaps not long enough to fully understand how permanent that transformation would prove to be.
In the decades that followed, “As Time Goes By” became one of those songs that belonged to everyone. Jazz pianists played it. Singers returned to it. It appeared in films, television programs, and concert halls. The BBC used it as the theme for a beloved long-running British sitcom of the same name, introducing the melody to audiences who had perhaps never sat down to watch Casablanca but who found themselves drawn to its particular mood all the same.
The American Film Institute has ranked Casablanca among the greatest films ever made. The song is considered one of the most beloved pieces of popular music from the twentieth century. Songwriters, archivists, and music historians have noted its place in the American songbook as both a Broadway artifact and a piece of cinema history simultaneously.
What makes “As Time Goes By” different from most songs permanently attached to a single film is exactly the thing this article set out to explain. It did not begin in that café. It began on a Broadway stage in 1931, in a show most people have never heard of, written by a man whose name most people could not place without looking it up. For eleven years it lived a quieter life, available to the world but not yet fully claimed by it.
Then a wartime film gave it a scene, a piano, and a moment so precisely right that the song’s earlier life became invisible. Audiences did not need to know where it came from. They only needed to hear it and feel what it made them feel.
Some songs are remembered because they were hits in a particular season. “As Time Goes By” is remembered because it found its way into something deeper — the part of people’s memories where certain melodies, certain moments, and certain losses are kept safe from the passage of time.
The fundamental things apply, as the song suggests. And for more than ninety years now, they have.