TIGA ALPHABlog

← All articles

Query by Humming: How Software Finds a Song From a Tune

News ·

Query by Humming: How Software Finds a Song From a Tune

Query by humming is a type of music search where you sing, hum or whistle a melody and software suggests which song it belongs to. Unlike recording-matching tools, which compare a clip of the original track, it has to work from an imperfect human performance: wrong key, uneven tempo, missing notes. It succeeds by focusing on the shape of the melody rather than exact pitches, an idea that also says something useful about how musicians remember tunes.

Why humming is a hard search problem

When you hum a song, you rarely start in the original key. You may speed up in the chorus, drop a note or add a slide. Background noise and the natural wobble of the voice make pitch less stable. A system that demanded an exact match would almost never find anything.

So query-by-humming systems ask a different question: which stored melody has a similar pattern of ups, downs and note lengths, regardless of starting pitch and speed?

An early idea: the melodic contour code

In 1975 the British writer Denys Parsons published a directory of tunes in which each melody was indexed only by the direction of its notes. Every note after the first was written as U for up, D for down or R for repeat. Remarkably, a short string of these letters was often enough to tell many well-known themes apart.

This approach, often called the Parsons code, captures contour. It ignores interval size and rhythm, yet it shows how much identity lives in a melody's direction.

How modern systems work

Current tools combine several steps. Details vary, but the general flow looks like this.

Pitch tracking

The software estimates the fundamental frequency of your voice many times per second, turning the hum into a pitch curve.

Cleaning and segmenting

It smooths small wobbles, removes silence and may split the curve into note-like segments.

Making the melody key-free

Instead of storing absolute pitches, the system looks at intervals or at pitch relative to an average. Humming in a different key then produces nearly the same pattern.

Allowing for tempo changes

Methods such as dynamic time warping stretch and compress the timeline so a slow hum can line up with a faster reference.

Matching against a database

The cleaned pattern is compared with stored melodies, and the closest candidates are ranked.

Two hands resting on piano keys in warm light

Where machine learning comes in

Older systems relied on hand-built rules for each step. Newer ones often use neural networks trained to turn both hummed queries and original recordings into compact numerical fingerprints, sometimes called embeddings. Songs whose melodies sound alike end up close together in that numerical space, even when the timbre is completely different, voice versus full band.

Google introduced a hum-to-search feature in 2020 and explained publicly that it used machine learning models to turn a hummed melody into a number-based sequence representing the tune. This kind of approach can cope with a wide range of singing abilities.

Limits remain. Very short queries, songs with repetitive melodies and pieces that are mostly rhythm or texture rather than melody are harder to identify.

What this teaches pianists about melody

The technology highlights something teachers often emphasise: the core of a melody is its shape and rhythm, not the exact key.

  • Transposing a tune to a new key keeps it recognisable, which is why practising pieces in more than one key strengthens understanding.
  • Contour is memorable. When you learn a new piece, sketching the rise and fall of the main line helps memory.
  • Rhythm carries identity too. Two melodies with similar contours can be told apart by their note lengths.

A short exercise

Choose a simple song you know well. Write its first phrase as U, D and R letters. Then play it on the piano starting from three different notes. You will hear how the contour holds the identity while the key changes.

From finding songs to learning them

Melody recognition and pitch tracking also support practice tools that listen while you play. An AI learning app such as TIGA ALPHA follows the notes you play on the keyboard and compares them with the expected part, giving feedback that would have been impossible for software a generation ago.

FAQ

Q: Does humming in the wrong key matter?

A: Usually not. Most systems compare intervals or relative pitch, so the starting note is less important than the pattern.

Q: Is query by humming the same as audio fingerprinting?

A: No. Audio fingerprinting matches a clip of a specific recording; query by humming matches a melody performed by a person.

Q: Why does whistling sometimes work better?

A: Whistling tends to produce a clearer, steadier pitch than humming, which makes pitch tracking easier.

Q: Can it find classical pieces?

A: It can if the database includes them and the query is melodic enough, though long works with many themes are harder.

Get started with TIGA ALPHA

TIGA ALPHA is an AI piano teaching app built by a Thai team, with lessons in 10 languages: Thai, English, Mandarin, Arabic, Japanese, Russian, Spanish, French, Hindi and Korean. Its CEO, Teacher Aum, has 20 years of experience in piano teaching, and that music teaching background shapes every lesson, while piano teaching with AI gives you feedback each time you play piano. Use it as an online piano lessons app for short daily sessions, follow it as a complete AI online piano course, or combine it with a piano course or piano learning course led by a teacher. Whether you want to learn piano from zero, learn piano online after a long break, learn music alongside your children or simply play music for fun, this online piano teaching application keeps your next step clear. New users get a 7-day free Premium trial, then US$24.99/month. Open the piano teaching app below and pick a first lesson that fits your week.

A hummed tune is messy data, yet the shape of a melody survives the mess, and that is exactly what good ears and good software both listen for.

Start learning free on TIGA ALPHA