Dream Melody

Sort of a cross between a Leitmotif and Arc Words, this is a short melodic fragment a character is aware of, and tends to hum or sing. Unfortunately, it's something of a mystery to them; its origin, meaning, and/or ending will not be revealed quickly. In a musical, this melodic fragment will eventually develop into a song.

Anime and Manga

 * The Nostalgic Music Box tune "Lacie" in Pandora Hearts.
 * Amazing Freaking Grace in So Ra No Wo To.
 * Lucy in Elfen Lied hums the Theme Tune of the show in her first scene, it's simple melody contrasting sharply with her homicidal tendencies. Later it's revealed that
 * Ranka in Macross Frontier frequently sings a distinctive melody she can't remember where or from who she heard... until Brera plays it on his harmonica, explaining that he heard it in his childhood but can't remember either. It's finally explained in the last episode that the melody is actually.
 * In 07-Ghost; At one point, Teito is the only one who can hear a song playing in the background, and eventually he sings it to himself. Frau tells him it's called the Raggs Requiem.

Film

 * The five-note theme from the movie Close Encounters of the Third Kind: "Start with a tone, up a full tone, down a major third, drop an octave, up a perfect fifth."
 * Inception has a cleverly hidden one. The song Non, je ne regrette rien has an obvious use of being played to sleepers and be heard in their dreams, warning them that they will be woken up soon. However.
 * "Three Little Words" in the MGM songwriter-Biopic musical Three Little Words.
 * Peter Lorre's character from M whistles In the Hall of the Mountain King. Interestingly, Lorre himself couldn't whistle; the sound was provided by director Fritz Lang.
 * All the more effective because it's the only music in the film.
 * In Prince of Egypt, Moses casually whistles his true mother's lullaby - we've actually seen said lullaby on screen, but it sets things up for his sister Miriam's reveal.
 * The original black & white version of The 39 Steps.
 * In Alfred Hitchcock's film Shadow of a Doubt, young Charlie has The Merry Widow Waltz stuck in her head for the first little bit of the film, but can't remember the title or origin of the tune. This is to illustrate the almost-telepathic connection she has with her Uncle Charlie,
 * Enola hums one of these tunes in Waterworld.
 * In Night of the Demon, scientist-skeptic Holden hears an eerie tune in his head after the cult leader he's investigating puts a curse on him. Later he hums the tune to his associates, who recognize it as a component of demonic spells. The tune is a recurring theme in the soundtrack music itself.

Literature

 * This is a minor plot point in Nineteen Eighty-Four, where Winston can only remember the first two lines of a song about churches in London.
 * There's also Under the spreading chestnut tree / I sold you and you sold me...
 * Atlas Shrugged has Dagny hearing a few whistled notes of "Halley's Fifth Concerto" (from a composer who only wrote four concertos before disappearing).
 * There is the Miorita of My Swordhand Is Singing. At first Peter hates it and believes that it doesn't make any sense. His father, Tomas, tells him that some people do understand it, while Sofia tells him that he has to simply understand it.

Live Action TV
"Early one morning, Just when the sun was shining. I heard a maid sing from the valley below. "Oh, don't deceive me, Oh, never leave me How could you use a poor maiden so?""
 * The drumbeat inside the Master's head in Doctor Who, which he's had rattling in his head ever since he looked into the Untempered Schism at the age of eight. This apparently drove him insane. The End of Time reveals
 * A major Tear Jerker in the Star Trek: The Next Generation episode "The Wounded", where both Miles O'Brien and his old Captain are haunted by an old Irish war ditty that turns out to have strong symbolic connections to the the events and backstory of the episode's plot.
 * In Battlestar Galactica, four major characters after they realize they've all been hearing the same unearthly music playing throughout the ship. (The song is, in fact, an indie-rock cover of Bob Dylan's "All Along the Watchtower").
 * And it's now shown up in the minds of and.
 * The melody Dax keeps humming in the Star Trek: Deep Space Nine episode "Equilibrium," which eventually turns out to have been.
 * "Never Leave Me," from Buffy the Vampire Slayer season 7 (the song, not the episode) which is the trigger.

Theater

 * The name comes from the ancient (1910) musical Naughty Marietta; its Dream Melody is better known as "Ah! Sweet Mystery of Life."
 * Another Musical Theatre example is Lady in the Dark, in which the frustrated magazine editor Liza Elliott keeps humming a childhood tune to herself at times when she is lost in thought or is overcome with panic. She can't recall the words to it ("My ship has sails that are made of silk...") until she relives her childhood in flashbacks with the help of her psychoanalyst. Lyricist Ira Gershwin compared the importance of "My Ship" to the show to that of "a stole necklace or missing will to a melodrama."
 * In A Streetcar Named Desire, Blanche has the Varsouviana polka stuck in her head. This upsets her because

Video Games

 * Garnet's song in Final Fantasy IX, which ends up as the game's main theme and vocal Theme Song, "Melodies of Life".
 * The Hymn of the Fayth in Final Fantasy X also counts, for Tidus; he finds himself humming it in a flashback, but its connection to Spira is only made clear later. (The track title for Tidus's murmuring is called Hum of the Fayth.)
 * And this is how you get the Good Ending in Chrono Cross,  the tune is played in many places in-game but especially in the   Very Definitely Final Dungeon.
 * Will in Illusion of Gaia has his grandmother's lullaby, which turns out to be the key to revealing her village of origin, and an identifying call. Also, a couple dungeons have background music that turn out to be versions of other melodies important to the plot.
 * The Victory Hymn in Metal Gear Solid 4 is sung as a memory aid by Sunny and whistled by the Resistance member Snake has to stalk. It's heard again at the end in an awesome Ennio Morricone-Spaghetti Western-style arrangement - maybe the characters can see the game's happy ending?
 * The Tsukimori Song from Fatal Frame 4. Bits and pieces of the song are the only things that protagonist Ruka can remember from her childhood.
 * Remember 11: Kagome, kagome...

Western Animation

 * In Futurama, Fry has an intimate association with the song "Walkin' on Sunshine", recurring as his favorite song, a fact given unstated but Tear Jerker Fridge Brilliance when it was revealed . Often implied to be a short-cut reference to Fry's old life in the 20th century.