Songs in the Key of Lock

"''Rhythm is the key as you open up the door"

- Hive, Ultrasonic Sound

Using music and musical instruments as security measures. Pianos or similar instruments are common, as you are blatantly dealing with keys. Can often be the way to conceal your secret lair by being Hidden in Plain Sight. The tune itself may be significant/ironic, or the Theme tune or Leitmotif of a character.

Subtrope of Solve the Soup Cans. Compare with Musical Trigger. Can be related to Only Smart People May Pass, if actual musical ability is required.

Comic Books

 * In one issue of The Incredible Hulk the Leader's time machine is programmed by playing a piano keyboard.
 * In a Scrooge McDuck story by Carl Barks that's a riff on The Hunchback of Notre Dame, Scrooge programs his vault so that it can only be opened by playing "My Bonnie Lies over the Ocean". Trying to protect his secret by using a wishing well (It Makes Sense in Context), he inadvertently reveals it to the hunchback (who lives near the bottom of the well scooping up the coins people throw in and eavesdropping on their wishes in the process), which kicks off the plot.
 * In one issue of Muppet Babies, the group imagines that the world is running out of music. In their imaginations, it turns out that it's being eaten by the Note-All, with approval from Piggy, who wants her music to be all there is. His staff puts the rest behind bars. When the Note-All eats Piggy's singing, as well, she decides to go free her friends. When physical keys don't unlock the bars, Rowlf suggests a musical key. When Piggy hits high C, the bars open.
 * One shows up in Warren Ellis' Ignition City, triggered by the owner's favorite song - "A Nightingale Sang In Berkeley Square".

Film

 * James Bond
 * In Moonraker, access to Drax's base is controlled by a musically coded keypad. The tune is the same notes the aliens use in Close Encounters of the Third Kind.
 * In For Your Eyes Only, the Identigraph room in Q's lab has a musical lock. The 7-note key is the title passage of "Nobody Does It Better" from The Spy Who Loved Me (2 films earlier); it is less obvious, though, because Q stops after 5 notes and James Bond fills in the final 2 a few seconds later.
 * In The Goonies, a creepy pirate organ opens a door or collapses the floor.
 * Batman Begins: the Batcave is accessed from Wayne Manor by playing a specific sequence of keys on the piano.
 * Willy Wonka and The Chocolate Factory. In Willy Wonka's factory, the door to enter the Chocolate Room (with the chocolate river) had a musical lock.
 * Specifically, the tune for the lock is the Overture from "The Marriage of Figaro," by Mozart, not Rachmaninoff, as Mrs. Teevee claims.
 * The film adaptation of Richie Rich had this with the parents unlocking the family vault by singing along with the code tune, "Side by Side", as a duet. The villain was not amused.
 * The lock stops recording after the first line, "Oh, we ain't got a barrel of money," which means that this is the actual key (as ironically befits a massive vault). The parents only sing the rest of the verse out of nostalgia and a need to be saccharine.
 * Monsters vs. Aliens: The security lock to the central core of Galaxar's ship is protected by a musical sequence which seems to be right out of Dance Dance Revolution.
 * In Hudson Hawk, the villains use a ridiculous-looking set of handcuffs with colour- and sound-coded buttons. Which makes it trivial for Hawk to get out of them (in fairness, it's probable that they intended him to escape eventually).

Literature

 * Pops up everywhere in Sharon Shinn's Samaria series. All angels are born with perfect pitch and singing voices, with which they can pray for all manner of divine intervention - rain or sunshine, cures for plagues, or even a good old-fashioned smiting. Meanwhile, enterprising mortals have come up with musical locking boxes and other such aural toys. The theme of musical control is so heavily emphasized that the nature of the Samarians' god winds up being something of an Un Reveal.
 * Used once at least in the Old Kingdom series. A shortcut to Abhorsen's House in Sabriel will only open to the sound of Mosrael, a bell which is otherwise never used in the series (it sends the ringer into Death.)
 * In book two of The 39 Clues, the search for the Clue eventually leads Amy and Dan to The trigger even works when

Live Action TV

 * Star Trek: The Original Series episode "The Paradise Syndrome". The obelisk left by the Preservers had a door that opened in response to a specific sequence of sounds (musical notes or speech tones).
 * This was done in the season 3 finale of Lost: Charlie had to enter a code to the tune of a Beach Boys song to unjam the signal going out from the island.
 * In "Suckers," an episode of CSI they investigated the robbery of a hotel vault. At the end Grissom realises that.
 * In one episode of Kyle XY Kyle and Jessie called Kyle's girlfriend to get her to play a song that opened a lock.
 * In Doctor Who, "The Five Doctors", the fifth Doctor played a harp to get into the villain's lair. The tune itself was Hidden in Plain Sight.
 * In Stargate Atlantis, Janis, an Ancient scientist, used three different tones played in order to hide his secret lab.
 * The first season of The Mole ended with a complex, multi-part puzzle that involved one of the remaining contestants stuck in a locked room with a xylophone and sheet music. The door would only open if he could play "Mary Had a Little Lamb"... and he couldn't read music.

Tabletop RPG

 * Dungeons & Dragons. The 3rd Edition Dungeon Master's Guide mentioned a note played upon a lute as a possible key to open a magical door.

Video Games

 * One early area of Trace Memory has you play the piano to open a secret passage, and later using a music box to open a fireplace passage.
 * Resident Evil has a piano you play Beethoven's "Moonlight Sonata" on to unlock something. Jill knows piano; Chris has to find Rebecca.
 * At one point in The Neverhood, you have to open a door by spitting into a Series Of Tubes to make them whistle the same tune as another series of tubes.
 * The Legend of Zelda: Ocarina of Time, taking from a few earlier games, has several dungeons that you unlock by playing different songs on your ocarina.
 * They are all a character or area's Leitmotif... For example, the Sun's Song is the sun's leitmotif; it plays whenever the sun rises.
 * And The Legend of Zelda: Majora's Mask, its direct sequel as well.
 * And Wind Waker, where the notes are conducted on the titular baton.
 * Averted in the sequel, Phantom Hourglass, where there is no instrument whatsoever. The third game, Spirit Tracks, however, makes up for this with the Spirit Flute, which utilises the DS microphone. Playing duets with the Lokomos help restore the Spirit Tracks, which enable you to go to new areas.
 * Prince of Persia: The Sands of Time. In the GBA version, there are several levels that are passed by playing a certain tune in a certain sequence.
 * In Final Fantasy X-2, there is a puzzle involving repeating notes.
 * Final Fantasy VII has the final Limit Break for Tifa that is obtained by playing the right notes on the piano.
 * Final Fantasy VIII has an organ that needs to be played to open a gate.
 * A dungeon in Final Fantasy IX has bells as Interchangeable Antimatter Keys.
 * In Baldur's Gate: Dark Alliance II, you have to open a secret passage by playing a harpsichord.
 * Brutal Legend has various Guitar riff sequenced that activate certain powers, up to and including opening new areas.
 * In Outcast you had to put the right pipes (as in flute pipe) into the right sockets on an altar (or something) to play a certain melody. After accomplishing this, you'd get another key for something else...
 * The Selenitic Age Descriptive Book in Myst is accessed via a five-note combination.
 * All the Myst games seem to have at least one sound puzzle each. In Riven, the combination to unlock Catherine's cell is revealed by listening to.
 * Riven also has the overarching animal-sounds puzzle that is scattered across the islands. There are five balls with a D'ni number carved in them, and each makes a Riven animal sound when spun (using at least one fictional animal.) The code makes perfect sense, as it would only be understandable by someone well-versed in both Riven and D'ni culture (it was intended for Atrus, but the player will figure it out eventually.)
 * The drawbridge passtune in Nethack. You find it out by either playing Mastermind or by having your god tell it to you.
 * Loom's Magic Music starts you off with the "Opening" draft, which works as a universal one of these (where The Password Is Always E-C-E-D).
 * There are a couple of puzzles in Lufia II where you have to step on "musical note" tiles in a certain order to open the locked doors.
 * StarTropics has a giant organ with eight keys, representing the notes of a musical scale. The solution comes from a parrot that says "Do me so far, do me?" This, of course, means playing "Do Mi So Fa Do Mi" on the organ.
 * Wonder Boy in Monster World requires you to remember short ocarina sequences to open the doors in the first dungeon.
 * Eternal Darkness: Sanity's Requiem has you play one song three times: twice on an organ, once on a piano.
 * The 7th Guest has one shown here involving a piano.
 * One of the adventure games in the Trapped series (not The Trapped Trilogy, the Trapped Series) requires you to play the tune from a music box on the piano to open a secret door.
 * Such a puzzle exists in Silent Hill 1, the only clue being a poem about birds. A puzzle involving a child's toy piano with pictures of birds on it appears in Silent Hill: Shattered Memories, as a Shout-Out to the original game.
 * You don't actually have to solve a puzzle, but in Chrono Trigger playing an organ always reveals hidden doors.
 * In Chrono Cross, each element has a unique tone when cast in battle. Playing  with these tones when fighting the Final Boss will instantly win the battle and free  . This unlocks a better ending than the player would get by killing the boss.
 * Being able to pull it off successfully is hard because the boss can interrupt (or help) the melody with his own magic.
 * Lunar: Silver Star Story has a duet between true lovers as the key to one dungeon. A long-distance duet between the leads opens it. Kyle and Jessica make for a Dreadful Musician duo, while Nash is too worried about stepping on Mia's notes to harmonize.
 * Illusion of Gaia requires protagonist Will to play specific tunes on his flute to open several gates.
 * At one point, you trade away one of the songs you no longer need. ...zah?
 * Eternal Sonata has you play increasingly long portions of on a large piano in order to progress through the Xylophone Tower of the Shining Keys. It doesn't unlock door or gate, but it does cause a sloped ramp to appear each time.
 * Frequently in Zork Nemesis, since the element of water is associated with music and the alchemist of water was a music teacher. The first one is a fountain which can be opened by turning on streams of water which correspond to the notes in a melody played on pan pipes.
 * Near the end of God of War 3, there's a puzzle that doesn't even bother trying to hide what it is, as the "notes" are copies of the Playstation's four main buttons and the tune you play is the franchise's Leitmotif.
 * Fallout 3's quest Tranquility Lane, set in a Lotus Eater Machine, has a possible ending where the player character can activate the simulation's failsafe by reproducing the ubiquitous Leitmotif on a collection of tuned household items.
 * In The Lost Crown, Nigel must repair a church organ and then play a specific sequence of notes to banish an evil ghost which blocks his path to a vital clue.
 * King's Quest IV features an organ at the top of a tower in a haunted house. The organ has a secret drawer in it, which opens if the organ is played correctly (Rosella has to find the sheet music first).
 * King's Quest VII has another music puzzle in Etheria involving a harp, which will transport Valanice to a sort of pocket dimension where she can speak with the Three Fates if she plays the right notes on it. The clues to the notes are given by the faerie dragons flitting around in another area of Etheria.
 * One way of getting control of the Nautilus in the game Return To Mysterious Island involved playing a few bars of music solely on the black keys of the Nautilus's organ (as, apparently, Captain Nemo specialized in playing music that required only the black keys).
 * Seiklus uses a giant piano. The keys are colored, and you have to jump on them in a sequence found elsewhere.
 * Dream Chronicles series loves "repeat the sequence" puzzles involving pressing the keys of some musical instrument (even if it's just the key order you have to memorize, not the tune itself - you can see which keys are being activated).
 * The original game has the piano room, where clicking portraits on the wall will produce different tunes for you to repeat; completing them all opens the door to the outside.
 * The second game has the organ room, where you need to repeat several tunes in order to unlock the passage to the second floor. Another floor has a puzzle requiring you to put several musical instruments in proper order, indicated by a book found in the library.
 * The third game has another organ-like instrument, where the same sequence-repeating type of puzzle protects several items you need to obtain.
 * The FMV Lawnmower Man game has a very basic Simon-like musical keyboard level, but it takes forever to watch the player character enter the code after you do.
 * In the text adventure Augmented Fourth, the player character has occasion to play a piece called "The Well-Tampered Xylophone", which consists of exercises in "twenty-five keys". The extra one turns into an actual key.
 * Most of the time in Aquaria, Naija uses her songs to change into a form that is best suited for passing a certain obstacle, i.e. using the Beast Form to swim past strong currents. However, there are a couple of cases where just singing is enough to remove an obstacle, such as the door in the Song Cave, the whale in The Abyss, and.

Web Comics

 * The MS Paint Adventures series Problem Sleuth has the same puzzle as Resident Evil as a Shout-Out. It also plays with this trope by occasionally literally using musical instruments as security measures (eg. wedging a door shut with an oboe) - at one point "security measures" is even Pot Holed to a Google Image Search for "woodwind instruments".

Web Original

 * In the Lonelygirl15 story "lonelygirl15 Season One Finale", the door to the Order base would only open if certain musical notes were played in sequence.

Western Animation
"Klang: "She said 'B', not 'B Flat'!""
 * In Xiaolin Showdown, the vault for the Shen Gong Wu is opened by playing specific notes on wind chimes.
 * In the South Park episode "Towelie", Towelie attempts to remember the code to enter the "Secret Government Base". The buttons make a noise as they are pressed and Towelie plays the tune to "Funky Town". Which doesn't open the door.
 * The episode "Imaginationland" uses this as an Overly Long Gag.
 * The Batman the Animated Series episode "The Cat and the Claw" featured one of these where the keys of a piano had to be pressed in the right order - the first few bars of Beethoven's Ode to Joy - to open a secret door.
 * Another puzzle, this one courtesy of the Riddler, featured a door and three keys, labelled "A", "C" and "D". Trying either the "A" or "D" key releases a few giant circular blades at the would-be solver, but the key of C? No sharps.
 * One Scooby Doo episode involved an organ, and the phrase "feed the organ" to open a secret passage.
 * Which was also the sequence, "F", "E", "E", "D" keys.
 * Appears prominently in the Tale Spin two-parter "For Whom the Bell Klangs". The ancient civilization of Tinabula based all its technology around sound, including . Unsurprisingly, they encounter a door early on that is meant to open with a precise musical note: archaeologist Katie Dodd has the perfect pitch necessary to open it, but the hapless mook who tries first isn't so lucky.


 * On the Foster's Home for Imaginary Friends episode "The Big Cheese", no one knows the combination to disable the new security system. No one, that is, except Cheese, who is singing the beeps the keypad made when it was entered. Hilarity Ensues as the others try to figure out the combination one note at a time.
 * An episode of Jimmy Two-Shoes had Heloise enter her secret lab in the Absurdly Spacious Sewer by tap-dancing in rhythm on a manhole.
 * Josie and the Pussy Cats in Outer Space, episode "The Hollow Planet". A prison door unlocks when a whistle with a specific pitch is blown twice.
 * Alvin and The Chipmunks once got press-ganged into traversing an ancient temple, with traps that get disabled through singing. It seems, though, that any song will do as long as it's in chipmunk voices, since a second group of chipmunks go through it later by singing a completely different song than Alvin and his brothers did earlier.

Real Life

 * Averting this trope in Real Life is why tonal keypads at ATMs don't use different pitches for each number, preventing eavesdroppers from copying other peoples' PINs by sound.
 * If you use a phone number a lot, eventually you'll be able to tell if you've entered a wrong digit by sound alone.
 * Technology Marches On—most people don't dial numbers any more, and let their cell phones remember the number instead.