Audio AI Itọsọna

Orin Gen

MusicGen is Meta's open-weight text-to-music model, published in June 2023, that writes music as a sequence of compressed audio tokens using a single transformer language model.

Gbọ si itọsọna yiiAI-ṣe afihan · ~8 min

Lori iwe yi9 min kika
  1. Akopọ
  2. Awọn gbigba bọtini
  3. Jin Dive
  4. Generating and checking a short MusicGen clip
  5. Real-World imuse
  6. Ojo iwaju ti MusicGen
  7. Fifi o sinu iwa
  8. Awọn orisun ati siwaju kika
  9. Tesiwaju Ṣiṣawari
  10. Awọn ibeere ti a beere nigbagbogbo

Akopọ

It can follow a text description such as a genre and mood, or a hummed or played melody, and outputs 32 kHz audio. Its code is MIT-licensed, while its weights are licensed for non-commercial use.

Awọn gbigba bọtini

  1. MusicGen is a single-stage transformer that generates EnCodec audio tokens from a text description and, optionally, a melody.
  2. Meta released MusicGen weights and code as part of AudioCraft on 2 August 2023.
  3. MusicGen was trained on about 20,000 hours of licensed music and comes in 300M, 1.5B and 3.3B parameter sizes.
  4. The delay interleaving pattern turns 30 seconds of four-codebook audio into about 1,500 autoregressive steps.
  5. MusicGen cannot produce realistic vocals, because vocals were removed from its training data.
  6. MusicGen code is MIT-licensed, but its model weights are CC-BY-NC 4.0, which prohibits commercial use.

Jin Dive

MusicGen is a model that generates music from a text description, optionally guided by a melody. It was introduced by Jade Copet and colleagues at Meta AI in the paper "Simple and Controllable Music Generation", first posted to arXiv in June 2023. It works the way a text language model does, predicting the next token from the previous ones, except that its tokens represent short slices of compressed audio rather than words. A separate neural audio codec turns those tokens back into sound. The word simple in the title refers to the design: one transformer generates everything in a single stage, instead of the chain of models that earlier systems such as Google's MusicLM used to go from coarse to fine detail.

The first ingredient is EnCodec, a neural audio codec from the same Meta team, described in an October 2022 paper. A codec compresses audio into a compact form and reconstructs it. The MusicGen version takes 32 kHz mono audio, downsamples it by a stride of 640 samples to 50 frames per second, and represents each frame with residual vector quantization (RVQ): four codebooks of 2,048 entries each, where the first codebook captures the coarse content and each later codebook encodes what the previous ones missed. Thirty seconds of music therefore becomes 1,500 frames, each with four tokens.

The second ingredient is how those four parallel token streams are fed to one transformer. Predicting all 6,000 tokens of a 30-second clip one by one, called flattening, is accurate but slow. Predicting all four codebooks of a frame at once, called parallel, is fast but ignores dependencies between them. MusicGen's default "delay" pattern offsets each codebook by one step, so at each step the model predicts codebook 1 for the current frame, codebook 2 for the previous frame, and so on. The paper says this turns 30 seconds of audio into 1,500 autoregressive steps. In its ablation, flattening still scored best, delay came close, and parallel was worst.

Conditioning steers the generation. Text prompts are encoded by a frozen T5 text encoder, and the paper also tested FLAN-T5 and CLAP. For melody, the model reads a chromagram, a representation of how much energy falls in each of the 12 pitch classes over time. The authors found that the raw chromagram led the model to copy the original track, so they kept only the dominant pitch class at each step and used Demucs, a source-separation model, to remove drums and bass first, because those dominated the chromagram. Generation uses classifier-free guidance: during training the condition is dropped 20% of the time, and at inference the model blends conditioned and unconditioned predictions with a guidance scale of 3.0 to follow the prompt more closely.

Training used about 20,000 hours of licensed music: an internal set of 10,000 high-quality tracks plus 25,000 and 365,000 instrument-only tracks from the ShutterStock and Pond5 collections, all at 32 kHz with text descriptions and metadata. The team trained models of 300 million, 1.5 billion and 3.3 billion parameters for one million steps on 30-second crops, using 32, 64 and 96 GPUs respectively. Meta announced the model publicly on 2 August 2023 as part of AudioCraft, alongside AudioGen for sound effects and an improved EnCodec decoder. The Hugging Face model card says the version 1 models were trained between April and May 2023.

On the MusicCaps benchmark of expert-written music descriptions, MusicGen compared well. Frechet Audio Distance (FAD), which measures how far generated audio statistics are from real audio, was 3.1 for the 300M model, against 4.0 reported for MusicLM, 7.5 for Mousai and 14.8 for Riffusion; Noise2Music reported the best FAD at 2.1. In human ratings on a 1 to 100 scale, the 3.3B model scored 84.81 for overall quality and the 1.5B model 83.70 for relevance to the text, against 80.51 and 82.35 for the public MusicLM demo. The authors note that larger models did not always improve automatic metrics even when listeners preferred them. With melody conditioning, the similarity between the reference and generated chromagrams rose from 0.10 to 0.66. A stereo variant, fine-tuned from the mono model with eight codebooks, was rated higher than mono.

Compared with alternatives, MusicGen's main trade is simplicity for some control. Hierarchical systems like MusicLM cascade several models, which the MusicGen authors avoided. Diffusion-based systems such as Riffusion and Mousai generate spectrograms or latents through iterative denoising rather than token by token. Within token-based models, MusicGen's interleaving patterns are its distinguishing choice. Its open release is also a difference: Meta published weights and code, while MusicLM's implementation was not public at the time of the paper.

The limitations are stated by Meta itself. The model card says MusicGen cannot generate realistic vocals, because vocals were removed from training data; works best with English descriptions; performs unevenly across musical styles and cultures; sometimes collapses to silence at the end of a song; and may need prompt engineering. The paper's authors note that their method offers no fine-grained control over how closely the output follows the conditioning beyond classifier-free guidance, and that the dataset contains a larger proportion of Western-style music. They also raise the concern that generative models could compete unfairly with artists. The weights are licensed CC-BY-NC 4.0, which rules out commercial use, even though the code is MIT-licensed. In practice, running MusicGen requires Python, PyTorch and ffmpeg per the AudioCraft README, and a GPU is advisable for the larger checkpoints; the model card's examples generate clips of a few seconds at a time.

04Apẹẹrẹ ṣiṣẹ

Generating and checking a short MusicGen clip

  1. Install Hugging Face Transformers version 4.31.0 or later and scipy, and confirm the use is non-commercial under the CC-BY-NC 4.0 weight license.

  2. Load facebook/musicgen-small through the text-to-audio pipeline to keep memory use low for a first test.

  3. Generate a clip from the prompt 'lo-fi hip hop beat with soft piano and vinyl crackle' and save the returned 32 kHz array as a WAV file.

  4. Generate a second clip from the same prompt and listen to both; sampling with top-k makes each run different.

  5. Change one element of the prompt, such as swapping piano for saxophone, and check whether the instrumentation changes accordingly.

  6. Compare with the melody checkpoint by supplying a short reference melody and listening for whether the tune carries over.

Ohun ti o fihan

Two or more short instrumental clips at 32 kHz that reflect the prompt's genre and instruments. Check them by listening for prompt adherence, for any collapse to silence near the end, and by noting that no realistic vocals appear, both of which match the limitations in Meta's model card.

Real-World imuse

Meta released MusicGen with AudioGen and EnCodec as the AudioCraft framework on 2 August 2023, publishing model weights and training code so researchers could train models on their own data.

Melody conditioning: the MusicGen melody checkpoint extracts a chromagram from a reference track after removing drums and bass, then generates new music that follows that tune while matching a text prompt.

Researchers load the small, medium, large or melody checkpoints through Hugging Face Transformers (version 4.31.0 or later) with the text-to-audio pipeline to produce mono 32 kHz clips.

In the paper's listening tests on MusicCaps, the 3.3B-parameter MusicGen scored 84.81 out of 100 for overall quality, above the 80.51 measured for the public MusicLM demo.

The AudioCraft repository later added related research models such as MAGNeT, a non-autoregressive text-to-music model, and AudioSeal for audio watermarking, built on the same codebase.

Ojo iwaju ti MusicGen

The MusicGen paper names its own open problems: finer control over how strictly output follows its conditioning, and better data augmentation and guidance for audio conditioning such as melodies. Meta's August 2023 announcement acknowledged that the training data skews toward Western-style music and English-only descriptions, which limits the model's range. Since 2023, the AudioCraft repository has grown to include MAGNeT, a non-autoregressive text-to-music and text-to-sound model, MusicGen Style, JASCO for conditioning on chords, melodies and drum tracks, and AudioSeal for watermarking generated audio, which shows the research direction toward faster generation, richer musical controls and provenance tools. Questions about training-data licensing, attribution and the economic effect on working musicians remain unresolved across the field, and the MusicGen authors flagged unfair competition for artists as an open issue. Evaluations using shared benchmarks such as MusicCaps, together with human listening tests, remain the main way to compare newer music models with MusicGen.

Fifi o sinu iwa

Kini idi ti o ṣe pataki

  • Wiwọle ati arọwọto. O ṣe ilọsiwaju iraye si nipasẹ transcription, alaye, ati awọn atọkun ohun.
  • Iye owo ati isuna. Awọn ẹgbẹ Media le firanṣẹ ohun didan yiyara pẹlu awọn isuna-owo kekere.
  • Iyara ati iwọn. Awọn ọna ṣiṣe ti nkọju si alabara le ṣe ilana awọn ibaraẹnisọrọ sisọ ni iwọn nla.

Ṣọra fun

  • ilokulo ohun ati awọn ewu afarawe ṣe pọ si nigbati igbanilaaye ba sonu.
  • Yiye le ju silẹ kọja awọn asẹnti, awọn ede-ede, tabi awọn agbegbe alariwo.
  • Ohun afetigbọ sintetiki le jẹ aṣiṣe fun ọrọ ododo laisi isamisi to yege.

Next awọn igbesẹ

  1. Gba ifọkansi ti o fojuhan fun gbigba ohun, ti ẹda, ati ilotunlo.
  2. Didara idanwo kọja awọn agbohunsoke oniruuru ati awọn ipo abẹlẹ.
  3. Ṣetumo nigbati eniyan gbọdọ ṣe atunyẹwo tabi fọwọsi awọn abajade.
  4. Aami ohun sintetiki ki o tọju awọn igbasilẹ provenance fun iṣiro.

Awọn orisun ati siwaju kika

  1. arXiv (Meta AI)Simple and Controllable Music Generation
  2. GitHub (facebookresearch)AudioCraft: Open source code for audio generation
  3. Hugging Facefacebook/musicgen-large model card
  4. Meta AIAudioCraft: A simple one-stop shop for audio modeling
  5. arXiv (Meta AI)High Fidelity Neural Audio Compression

Tesiwaju Ṣiṣawari

Ìwé ìròyìn ọfẹ

Gba ìkànìyàn AI ojoojúmọ́

Ìtàn AI mẹta tó jẹ́rìí ní gbogbo owurọ́ ọjọ́ iṣẹ́, kọ́wé ní Gẹ̀ẹ́sì tó rọrùn. Ọfẹ́ fún gbogbo àkókò, kò sí ìpolówó.

Ìmeèlì kan ní gbogbo ọjọ́ iṣẹ́. Yọkúrò ní ìkànìyàn ní ìkànìyàn kan. A kò ta tàbí pín àdírẹ́sì rẹ.

Ṣe idanwo fun ara rẹ

Take the MusicGen quiz

Ìdáhùn lẹ́sẹ̀kẹsẹ̀ lórí gbogbo ìdáhùn, àti iwe-ẹ̀rí tó lè pin pẹ̀lú ID tó lè jẹ́rìí lẹ́yìn tí o bá kọ́ ẹ̀kọ́.

Bẹrẹ adanwo

Ṣe àtìlẹ́yìn ẹ̀kọ́ AI ọfẹ́. AI Understanding jẹ́ àjọ àìní èrè 501(c)(3) — kò sí ìpolówó, kò sí àkúnya owó, ní gbogbo àkókò. Ṣe ẹbun kan

Awọn ibeere ti a beere nigbagbogbo

What is MusicGen?

MusicGen is Meta's open-weight text-to-music model, published in June 2023, that writes music as a sequence of compressed audio tokens using a single transformer language model. It can follow a text description such as a genre and mood, or a hummed or played melody, and outputs 32 kHz audio. Its code is MIT-licensed, while its weights are licensed for non-commercial use.

Which input can a melody-conditioned MusicGen variant accept in addition to text?

The melody-conditioned variant can use a text description and a reference melody; this input is not available in every text-only checkpoint.

Iru kodẹki nkankikan wo ni o ṣe agbejade awọn ami ohun afetigbọ MusicGen sọtẹlẹ?

Awọn awoṣe MusicGen awọn ami iyasọtọ ti ipilẹṣẹ nipasẹ koodu EnCodec Meta, eyiti o tun ṣe iyipada awọn ami asọtẹlẹ pada sinu ohun.

How does MusicGen model multiple EnCodec code streams?

The architecture uses delayed interleaving in a single-stage autoregressive model; “single-stage” does not mean the whole song is generated in one forward pass.

Bawo ni MusicGen ṣe tẹle orin aladun ti a pese laisi didakọ gbigbasilẹ gangan?

Kromagram kan ya iru awọn kilasi ipolowo ti o wa ni akoko pupọ, jẹ ki MusicGen baamu ibamu ohun orin ati elegbegbe lai ṣe ẹda timbre atilẹba.

Eyi ti ise agbese ati ile tu MusicGen?

MusicGen jẹ idasilẹ ni ọdun 2023 gẹgẹbi apakan ti Meta Ise agbese AudioCraft AI, pẹlu koodu ṣiṣi ati awọn iwuwo awoṣe.