Sound as a signal
Autoregressive transformers left a recipe: a learned autoencoder turns an image into a short sequence of codes, and a transformer continues that sequence one code at a time. This extension takes that recipe, and the flows of The change of variables, to sound.
Sound is long. A microphone records air pressure, and a sound file stores it times per second as a waveform, a sequence of numbers in . Speech corpora such as LJ Speech, about 24 hours of one speaker, use Hz. WaveNet, the audio model of Autoregressive models, generates those samples one by one: 22,050 network passes for one second of speech. A three-minute song at 32 kHz is almost six million numbers.
Two answers make sound shorter. Speech systems keep a continuous summary, the mel spectrogram. Music systems compress the waveform into a few streams of discrete codes. This topic follows one model of each kind.
The spectrogram shows which frequencies sound when. The short-time Fourier transform cuts the waveform into overlapping windows and takes the Fourier transform of each; the magnitudes form a time–frequency image. With windows of 1024 samples and a hop of 256 samples, one second at 22,050 Hz gives frames.
The mel spectrogram also compresses the frequency axis the way hearing does. We tell pitches apart finely at low frequencies and coarsely at high ones, and the mel scale follows that. A frequency in hertz becomes, in mel,
so 1000 Hz maps to 1000 mel and 11,025 Hz, the highest frequency a 22,050 Hz recording can hold, to about 3176 mel. A bank of triangular filters, equally spaced in mel, sums the magnitudes into bands, and the result goes on a log scale. One second of speech becomes numbers instead of 22,050, about 3.2 times fewer. It is a small image: 80 rows, 86 columns per second.
The price is the phase. Magnitudes say how much of each frequency is present, not how the waves line up, so many waveforms share one mel spectrogram. A vocoder must invent a plausible waveform for it.