Generative AI / Modalities & Control
Generating sound and combining modalities.
Reviewed by Yuvaraj
Text-to-speech, music generation, image captioning, and visual question answering look like unrelated problems. They share one move: convert the signal, a sound, an image, a sentence, into a sequence of discrete tokens (or a compact array of numbers), let a transformer predict that sequence, then decode it back into the target medium. Master that pattern and most of modern generative audio and multimodal AI stops looking mysterious.
You almost never model a raw waveform directly. Audio at CD quality is 44,100 samples per second per channel; a few seconds is hundreds of thousands of values, far too long for a transformer to predict sample by sample. So the field uses two compressed representations.
Text-to-speech conditions generation on encoded text plus a speaker embedding; music and sound-effect generation condition on a text prompt.
Ask about this lesson, or about anything in AI. Answers cite the lessons they draw on.
Finished this lesson?
Mark it complete to earn XP, keep your streak, and schedule a review.
Follow one concrete path and name every transformation.
If you swap the middle stage for a mel-spectrogram, the final step becomes a vocoder converting that spectrogram to samples, same shape, different intermediate representation.
A multimodal model accepts and/or produces more than one modality, and the dominant recipe is still tokens. A vision-language model (VLM) answering a question about an image runs: image → vision encoder (a ViT-style network) → patch embeddings → a projection layer that maps them into the language model's embedding space → these visual tokens are concatenated with the text-prompt tokens → transformer → generated text answer (a caption, or an answer to a visual question). "Any-to-any" systems extend this so images, audio, and text all become tokens in one shared stream, letting a single backbone read and emit several modalities.
FAST-MOVING
Specific product capabilities, native voice, real-time video understanding, image-output fidelity, change every few months. Treat the tokenize-model-decode mechanism as durable; treat any named commercial feature as a snapshot.
For a curious beginner
Whatever the medium, chop it into small pieces, give each piece a number, and let the model learn which numbers tend to follow which, then translate the predicted numbers back into sound or pixels.
How it is actually used
Each modality gets an encoder that emits a token or embedding sequence; you merge the sequences, run one transformer, and attach a decoder per output modality. Fusion and decoding are swappable; the sequence model in the middle is shared.
The underlying mechanism
An encoder maps a signal to vectors in ; vector quantization sends each vector to its nearest codebook entry, giving integer tokens. The transformer models over the merged stream, indifferent to which modality produced each .
Common mistakes