AI Composition Is Not Black Magic: How Deep Learning 'Listens' to Music and Then Writes a Song

There's one moment I remember with unusual clarity. A friend sent me a piano piece and asked what I thought. I said it was pretty good — had a bit of a Satie feel — and asked where he'd found it. He said Suno had generated it: one line of lyrics, one style description, under thirty seconds total.
After that, I spent over a week getting to the bottom of music generation from first principles — not because I'm a musician, but because this is one of the few deep learning applications that delivers a genuine sensory impact. You don't need to understand AI to be stopped in your tracks by it.
What Music Looks Like to a Model
To get a model to "understand" music, the first step is converting sound into a format it can work with. The most direct approach is the waveform — feeding the model the raw amplitude of a sound signal over time. But the data volume is enormous: a three-minute song at 44.1kHz sampling rate produces nearly eight million values.
So most systems begin with a spectral transform, converting the waveform into a mel-spectrogram. Think of it as a two-dimensional "snapshot of sound" — time on the horizontal axis, frequency on the vertical, with colour intensity representing energy. This representation is far more compact, and it maps more closely to how human hearing works. (The human ear resolves low frequencies better than high ones; the mel scale compresses accordingly.)
The other route is symbolic representation — MIDI. MIDI breaks music down into discrete events: what time, which pitch, how hard, how long. The logic is very close to that of text tokens, which means Transformers can apply language model architectures directly to music. The core logic of the attention mechanism works here just as well: once a model has learned a chord, it develops probability distributions over which subsequent notes "should" appear.
Why Analysis Is Harder Than Generation
Music analysis is the prerequisite for generation, but it's already a significant challenge in its own right. Common tasks include:
- Genre classification: Is this jazz or R&B? The model learns statistical distributions over spectral features.
- Emotion recognition: Does this sound sad or happy? Harder than it seems, because the musical language of "sadness" differs across cultural contexts.
- Beat tracking: Finding beat positions within a raw audio stream — useful in DJ software and music licensing systems alike.
- Melody transcription: Converting a hummed melody or live performance into notation — Google's NSynth and the later MT3 have done substantial work here.
The emotion problem stuck with me most. Researchers found that models struggle to draw a clean line between "sad" and "melancholic," because the training labels were applied by humans — and humans are inconsistent. It's almost identical to the pitfalls of sentiment analysis in NLP.
Generation: From MuseGAN to Suno
The evolution of music generation models has tracked closely with image generation. Early systems used LSTMs to produce single-melody MIDI sequences. Then GANs arrived: MuseGAN (2018) could generate multi-track music simultaneously — drums, bass, harmony, melody — but the quality was rough, and the results didn't sound like anything a human would actually write.
The turning point came around 2023. Google's MusicLM generated music directly from text descriptions. Meta's MusicGen combined EnCodec audio compression with Transformer decoding, and quality made a notable jump. Then Suno and Udio commercialised in 2024, and you can now produce a complete song — with vocals, lyrics, and mixing — from a single descriptive sentence.
In plain terms, what these systems do is: compress audio into discrete tokens (analogous to VQ-VAE), use language model logic to perform generation in token space, and then decode back to audio. The "grammar" of music is translated into statistical regularities across token sequences.
A Few Real-World Applications You Might Not Have Considered
Beyond the obvious use case of "generate a song," deep learning's penetration into the music industry is actually far more distributed:
- Copyright detection: Spotify and YouTube run audio fingerprinting models against uploaded content for infringement checks — the inference volume these systems handle daily is staggering.
- Personalised recommendation: Beyond collaborative filtering, models now analyse audio features directly for cold-start recommendations, without requiring any listening history.
- Mastering assistance: Adobe's Project Music GenAI Control lets you adjust tempo, density, and other parameters in generated music — actual post-production control, not just a fixed output you take or leave.
- Dynamic game audio: Adjusting the emotional tension of background music in real time based on player state — a scenario that demands low-latency conditional generation.
Worth noting in passing: the model deployment and API decisions behind these applications are genuine engineering problems. The differences between cloud services in latency, cost, and flexibility are real and consequential — choices worth thinking through as carefully as whether to use AI at all.
Problems That Remain Unsolved
Having said all of the above, I want to flag a few things that aren't resolved yet. It's the more honest account.
First, long-range structure. A song has verses, choruses, bridges — a macro-level architecture that models still struggle to maintain consistently. Thirty seconds might sound fine; two minutes and things often start to fall apart.
Second, controllability. You ask for "a 1970s funk track with a brass section, suitable for advertising" — which of those conditions the model actually honours, and which it quietly ignores, is still hard to predict.
Third, training data and copyright. This isn't a technical problem but a legal one, and it directly determines which models can be commercialised and how they price their services. There's no industry consensus yet. It follows the same fault lines AI has hit elsewhere — questions of liability for AI-generated content are already being formally argued in court in medical contexts, and music copyright will eventually travel the same road.
One idea worth taking away: the current standard of music generation isn't "AI imitating music" — it's "AI learning a statistical grammar of music, then sampling within that grammar space." It doesn't understand sadness. But it knows which combinations of spectral features tend to make humans say a piece makes them want to cry. The distinction is philosophically significant, but practically irrelevant to the user. What matters is whether you can use it to make the thing you actually want to make.
Share
Related articles

Ad Certification Meets AI: Faster Reviews, But Is Creativity Still Safe?

How to Choose an AI Chatbot in 2026? Work Backward from Real Pitfalls to Find Your Best Fit

AI Risks Go Beyond 'Stealing Your Job' — From Bias and Black Boxes to Security Vulnerabilities, Here's What You Should Really Worry About

Tidal Begins Purging Millions of AI Songs — The Battle Over What 'AI-Created' Means Has Officially Begun