In 1978 John Lennon recorded a song at the piano in his New York apartment, on a cassette, with the television on in the background. After his death the tape was passed to the other three Beatles, who tried in 1995 to finish it. They gave up. The piano and the voice were on the same track of a poor recording, with a mains hum. Whenever they brought the voice up, the piano came with it.

In 2023 the song was released. The voice had been lifted cleanly out of the cassette using a system developed during the making of a documentary by the director Peter Jackson. The surviving members played to it, and it reached the top of the British charts.

Nothing had been generated. The voice on the record is the voice on the cassette. What had changed in twenty-eight years was the ability to separate sounds that had been recorded together.

Why it is hard

Mixing is addition. When a voice and a piano sound in a room together, the pressure at the microphone at each instant is the sum of what each would have produced alone. The recording holds one number per moment.

Separating them means recovering two unknown numbers from one known sum, at every instant. Taken as arithmetic that cannot be done. If the total is 7, the parts could be 3 and 4 or 1 and 6.

It becomes possible only by bringing in knowledge of what the parts are like. A voice has a characteristic structure, and so has a piano. Listeners do this effortlessly. Following one speaker in a crowded room is so ordinary that the psychologist Colin Cherry had to give it a name in 1953 for it to be recognised as a puzzle: the cocktail party problem.

Before learning

Early methods relied on tricks of the recording.

Centre cancellation. In a stereo mix, the lead vocal is usually placed identically in both channels. Subtract one channel from the other and anything in the centre disappears. This was the basis of "karaoke" buttons on old hi-fi equipment. It also removes the bass and kick drum, which sit in the centre too, and it leaves the reverberation behind.

Several microphones. With as many microphones as sources, in different positions, statistical methods can untangle them. This is no help with a finished stereo or mono recording.

Matrix factorisation. From the early 2000s, researchers broke spectrograms down into a small number of repeating spectral patterns, each switching on and off over time. A piano note has a consistent spectral shape and so does a drum hit. The method worked on simple material and struggled with real music.

The spectrogram mask

The representation that made progress possible is the spectrogram: time across, frequency upward, brightness for energy.

In that picture, sources that are thoroughly mixed in the waveform become partly separated. A sung note appears as a stack of thin horizontal lines, its harmonics, which wobble with vibrato. A snare hit is a vertical stripe, a bass note a few thick lines low down. They overlap, but less than one might expect, because at any given instant and frequency one source usually dominates.

This suggests a way of separating them. For each small cell of the picture, estimate what fraction of the energy belongs to the voice. That grid of fractions is a mask. Multiply the mixture's spectrogram by the mask and you have an estimate of the voice alone. Convert back to sound.

The problem is thereby turned into one of producing the right mask, and that is something a neural network can learn.

Training

The network needs examples in which the answer is known. Fortunately recordings are made that way: each instrument is on its own track before mixing. Given a set of songs with their separate tracks, called stems, you can create the mixture yourself and know exactly what the vocal part of it should be.

The network is shown the spectrogram of the mix and asked for the mask. Its output is compared with the true one, and its parameters are adjusted. After many thousands of examples it has learnt what voices, drums and basses look like in a spectrogram.

Public datasets made this possible. One widely used collection consists of 150 songs with separate stems for vocals, drums, bass and everything else, and became the standard test for the field. Commercial systems are trained on much more.

The architectures were borrowed from image processing. A design called U-Net, first devised for marking out structures in medical images, proved well suited: it squeezes the picture down to capture broad context and then expands it again, carrying fine detail across by direct connections.

In 2019 the research arm of a French streaming company released a trained separator as free software. It could split a track into two, four or five stems faster than real time on an ordinary computer, and it brought the technique to a wide public. A research team at a large technology company then published a system that works on the waveform directly, and later versions combining both approaches have led the published comparisons.

Progress is tracked with a measure of the ratio between the wanted signal and everything else in the output, in decibels. On the standard test set, the best systems rose from about 6 decibels for vocals in 2018 to above 9 a few years later. A gain of 3 decibels means the unwanted residue has been halved in power.

What still goes wrong

Present systems are impressive, and their faults can be heard and described.

Bleed. Faint traces of other instruments in a stem. Cymbals leak into the vocal, the voice into the "other" track.

Musical noise. A watery, burbling quality, caused by the mask switching cells on and off from moment to moment.

Lost transients and breath. Consonants, the attack of a note, and the air round a voice are noise-like and easily assigned to the wrong source.

Reverberation. The echo of a voice is spread out in time and overlaps everything. It tends to be split between stems.

Phase. Many systems estimate only how strong each frequency is and reuse the mixture's timing information when rebuilding the sound. Where sources overlap heavily, this adds a smeared quality.

Unfamiliar sources. The standard four categories suit rock and pop. A sitar, an accordion or two singers in harmony have no stem of their own and are divided unpredictably.

Like from like. Separating a voice from drums is comparatively easy, since they look nothing alike. Separating two violins, or two voices, is very much harder.

A good rule when listening to results: a stem played alone will reveal its flaws. The same stem, turned up or down a little within the original mix, usually sounds fine, because the errors are masked by everything else. This is why the technology is at its best for rebalancing and remixing, and weaker for true isolation.

What it is used for

Restoration. Film and music archives are full of recordings where everything was captured on one track. The documentary that led to the Lennon release drew on many hours of mono tape from 1969, in which conversations were often buried under guitars. Separation made the dialogue audible. Old concert recordings and early stereo mixes have been rebalanced and reissued.

Practice and teaching. Removing the bass from a track to play along, or isolating a part to study it.

Sampling and remixing. DJs and producers can extract a vocal without access to the original session tapes.

Speech. The same techniques separate a voice from background noise. This is the noise suppression in video calls and the core of newer hearing aids. Separating overlapping speakers remains difficult and matters a great deal for transcribing meetings.

Analysis. Transcribing a part, detecting chords or identifying a singer all work better on a clean stem.

Questions of permission

The technology raises matters that were formerly settled by its impossibility.

A producer who wanted to sample a vocal once needed the multitrack tape, and therefore the cooperation of whoever owned it. Now anyone with the finished record can extract it. The law of copyright has not changed. The practical barrier has gone.

An isolated voice is also exactly the material needed to train a system that imitates that voice. Separation and voice cloning are distinct technologies, and the first supplies the second.

There is the matter of intent as well. A mix is a set of artistic decisions. Releasing a rebalanced version of a recording whose makers are dead changes their work. The Lennon release was made with the agreement of his family and the participation of his surviving bandmates. Not every case will be so clear.

Trying it

Free, open-source separators run on an ordinary laptop, and several websites offer the service. A good first experiment is to take a song you know very well, split it into four stems and listen to each alone.

Two things usually strike people. The first is how much is audible that they had never consciously heard: a second guitar, a harmony, the bass player's fills. The second is the faults. The vocal stem has a faint ghost of the hi-hat, and the reverb has gone to the wrong place.

Then put the stems back together at their original levels. The flaws vanish and the song returns, which is a neat demonstration that the errors in the parts are equal and opposite. Whatever the network wrongly removed from one stem, it put into another.