To install audiocraft musicgen, create a Python 3.9 environment, install PyTorch 2.1.0 first, then install the audiocraft package, add ffmpeg, and generate an 8-second WAV with the small model to prove the chain works. The AudioCraft code is MIT, but the MusicGen weights are CC-BY-NC 4.0, so the released weights are for non-commercial use only. Local use requires a GPU, with 16 GB of memory recommended for the medium models. Use MusicGen for research, learning, and private tests you review by ear. For business videos, ads, or client work, use a source that grants commercial rights instead.
You want background music without another subscription. Meta’s MusicGen looks like the answer: type a description, get music, keep it local. Then the licence line changes the plan. The AudioCraft code is MIT, but the MusicGen weights are CC-BY-NC 4.0 โ non-commercial. You can install audiocraft musicgen today for research, learning, and private experiments. You cannot treat the weights as a free commercial library for a business video, ad, or client project. This guide installs it properly, proves one WAV file, and shows the honest maths beside a paid commercial option.
How we checked this guide
We checked the official AudioCraft GitHub repository, the official audiocraft package page on PyPI, the official MusicGen documentation inside that repository, and the official facebook/musicgen-small model card on Hugging Face on December 6, 2026. Install commands, Python and PyTorch versions, model sizes, GPU guidance, and licence lines in this post come from those official pages, not from roundups. We also checked Suno’s official pricing page on the same day for the paid comparison, because Suno is the commercial route many readers will weigh against a local install.
Prices and plan limits below are what that page showed on that date. Anything the official pages did not state clearly stays out of the maths. The dated price note at the end tells you when to re-check before you buy anything.
Read this first: the licence decides the job

AudioCraft is Meta’s PyTorch library for audio generation. It contains MusicGen, a text-to-music model, plus AudioGen, EnCodec, and other audio models. MusicGen takes a text description such as “happy rock” or “energetic EDM” and generates a music sample. Melody variants also accept a melody input and generate music guided by that melody and your text. That is the useful part. The deciding part is the licence split. The repository states the code is released under the MIT license. The same repository states the model weights are released under the CC-BY-NC 4.0 license. The Hugging Face model card repeats the same split: code under MIT, model weights under CC-BY-NC 4.0.
In plain words, you may use, copy, and modify the AudioCraft code under MIT terms, keeping the copyright and licence notices. The weights you download to actually generate music carry a non-commercial condition. Attribution is required, and commercial use is not granted by that licence. So the honest best-for line is narrow.
MusicGen is best for local research, learning how text-to-music models behave, private drafts, and non-commercial experiments where you control the machine and the files. Skip it as your production music source when the output will sell a product, promote a business, run in an ad, or ship inside client work. A $0 download is not a $0 commercial licence. That one sentence saves more money than any install trick in this guide.
The model card names the intended use as research on AI-based music generation and warns against downstream use without further risk evaluation. Limitations are explicit: no realistic vocals, English-trained descriptions, uneven performance across styles and cultures, occasional collapse to silence, and prompt engineering may be required. That makes the install a test bench, not a jukebox you trust blindly.
What MusicGen replaces, and what it does not
MusicGen replaces the first hour of hunting for a demo track when the job is exploration. Generate short instrumental ideas locally, change the prompt, and learn which description gives the tempo and texture you want. Prompts and files stay on your machine, with no per-generation bill beyond hardware and electricity you already pay for.
MusicGen does not replace a commercial music licence. It does not replace a stock library track with clear business rights, a commissioned composer, or a paid generator whose plan grants commercial use. It does not replace vocals, lyrics, or a finished song structure. The model generates music samples conditioned on text or melody.
It is not a DAW, not a mixing tool, and not a mastering chain. You still need to listen to every output, trim it, fade it, and check that it does not collapse into silence or wander away from the brief. It also does not replace judgement about platform rules. Even where a paid plan grants commercial rights, the platform you publish on has its own terms, and you remain responsible for following them.
MusicGen also does not replace the speech tools in this open-source series. If your job is narration, use a speech route such as our Bark AI text to speech guide for expressive local drafts you review clip by clip. If your job is a repeatable utility voice, our Piper TTS guide fits better. MusicGen’s job is music. Keep each tool on its own job and the buying decision stays clean.
Routes to install AudioCraft MusicGen
There are two sensible routes, and they serve different readers. Route one is the AudioCraft library itself. You create a Python environment, install PyTorch 2.1.0 first, then install the audiocraft package, then run the MusicGen API from Python. This is the route this guide follows, because it matches the official repository instructions and gives you the full library, including the melody workflow and the audio_write helper with loudness normalisation. Choose this route when you want the real install, the model choice, and control over generation parameters.
Route two is the Hugging Face Transformers route. The model card shows a text-to-audio pipeline and a processor plus model pattern using facebook/musicgen-small. That route suits a reader who already lives in Transformers and wants a quick generation test with fewer AudioCraft-specific pieces. It still downloads the same CC-BY-NC weights, so the licence warning does not change. It also still needs suitable hardware for a comfortable run. Do not choose route two hoping it changes the commercial answer. It does not. The weights licence follows the model, not the library you load it with.
Hosted demos on Hugging Face Spaces and Colab, linked from the official docs, suit a five-minute listen before you install. A demo is not a local workflow and gives no version control. Listen first, install second, and never download a 3.3B model before the small model has answered your question.
Requirements before you install

Start with the versions the official pages state. AudioCraft requires Python 3.9 and PyTorch 2.1.0. The installation instructions say to make sure torch is installed first, in particular before installing xformers, and they give the pinned command for torch 2.1.0. They also suggest installing setuptools and wheel before the package install. Treat those versions as the tested path, not as a suggestion you can casually upgrade on day one. A newer Python or a newer torch may work, or it may cost you an evening of dependency errors. For a first install, match the official versions, prove one file, and only then experiment.
Hardware is the second gate. The docs require a GPU with at least 16 GB for medium-sized inference, say local use must have a GPU, and note smaller GPUs can generate short sequences or longer ones with the small model. Sizes: small 300M, medium and melody 1.5B, large and melody-large 3.3B, with stereo variants. The docs call medium or melody the best quality-compute trade-off. Best trade-off is not best first install. On a smaller card, start with small and learn the workflow first.
You also need ffmpeg. The official instructions recommend having ffmpeg installed, either through your system package manager or through Anaconda with a version below 5 from conda-forge. Audio tools fail in dull ways without it: files that will not load, writes that error at the last step, and melody inputs that never decode. Install ffmpeg before your first generation test, not after your first confusing traceback. Finally, plan disk space and a cache location. Models are stored through Hugging Face, and the AudioCraft cache location can be overridden with the AUDIOCRAFT_CACHE_DIR environment variable. Decide where large checkpoints will live before the first download fills a small system drive.
Step 1: install AudioCraft MusicGen with PyTorch first
Create a clean Python 3.9 environment for this project. A virtual environment or a conda environment both work. The point is isolation: AudioCraft pins an older PyTorch, and you do not want that pin fighting the packages in your main Python. Activate the environment, then install torch 2.1.0 first if torch is not already installed in that environment. The official command is:
python -m pip install 'torch==2.1.0'Then install the build helpers the instructions suggest:
python -m pip install setuptools wheelThen install the stable AudioCraft release:
python -m pip install -U audiocraftPyPI lists audiocraft 1.3.0, uploaded June 3, 2024. This is a research library, not a weekly-updated consumer app. The repository also offers a bleeding-edge GitHub install and an editable clone install, mandatory for training. For inference, the stable package is calmer. Every unpinned upgrade you add on day one becomes a suspect when generation fails on day two.
Install ffmpeg through your system route now if it is missing. On Debian or Ubuntu style systems the official suggestion is:
sudo apt-get install ffmpegVerify the install with a tiny import test before you download any model. Run Python inside the environment and import the two pieces the first generation needs:
from audiocraft.models import MusicGen
from audiocraft.data.audio import audio_write
print("audiocraft imports ok")If that import fails, fix it now. Do not download a model into a broken environment and then debug two problems at once. Import errors at this stage usually mean the environment is wrong, torch is mismatched, or a dependency did not install cleanly. Rebuild the environment cleanly rather than stacking fixes on top of a half-broken one. A clean rebuild takes minutes. A layered repair takes hours and leaves you unsure which change actually fixed it.
Step 2: generate your first WAV file

Your first generation has one job: prove the whole chain works. Model download, GPU load, text conditioning, audio decode, and file write. Keep it short and keep it boring. The official AudioCraft example loads the small model, sets a duration of 8 seconds, generates from two descriptions, and writes each result with loudness normalisation at -14 dB LUFS. Follow that shape for your proof run:
from audiocraft.models import MusicGen
from audiocraft.data.audio import audio_write
model = MusicGen.get_pretrained("small")
model.set_generation_params(duration=8)
descriptions = ["happy rock", "energetic EDM"]
wav = model.generate(descriptions)
for idx, one_wav in enumerate(wav):
audio_write(f"{idx}", one_wav.cpu(), model.sample_rate, strategy="loudness")The first run downloads the model, so it will be slower than later runs. That is normal. What you are checking is the ending: two WAV files written to disk, each one playable, each one roughly matching its description. Play both files fully. Listen for the failure modes the model card warns about: a track that collapses to silence, a mood that ignores the prompt, or a texture that falls apart halfway. An 8-second proof that sounds coherent tells you the chain works. An 8-second proof that collapses tells you to fix prompts, duration, or hardware headroom before you generate anything longer.
Name your proof files properly from the start. The example writes numbered files, which is fine for a test and useless a week later. Rename the keepers with the model, the prompt, and the date, for example musicgen-small_happy-rock_2026-12-06.wav. Keep a short text log beside the files with the exact prompt, the model name, the duration, and what you heard. That log becomes your prompt memory. Without it, you will regenerate the same idea five times because you cannot remember which wording produced the one good result. With it, every generation teaches the next one.
Do not judge MusicGen on the first two prompts. The model card says it is sometimes difficult to assess what text descriptions provide the best generations, and prompt engineering may be required. Treat the proof run as a plumbing test, not a quality verdict. Once the files write and play, you have earned the right to judge quality. Before that, you are only judging your install.
Step 3: choose the model size and duration with intent
Model choice is a hardware decision wearing a quality costume. The small model has 300M parameters and is the right starting point on smaller GPUs and for short sequences. The medium model has 1.5B parameters and, with the melody model, gives the best trade-off between quality and compute according to the official docs. The large model has 3.3B parameters. Melody variants accept text plus melody conditioning. Stereo variants fine-tune each size for stereo generation. Ten pretrained models are listed in total. More parameters do not rescue a weak prompt, and a larger model on a card without headroom produces errors, not better music.
Use this order. Prove the workflow on small at 8 seconds. If it plays cleanly and your GPU has the recommended memory, try medium or melody with the same prompt and duration, and compare mood, rhythm, and ending side by side. Move to large only when medium is close and scale has a specific gap to fix. Each step up costs download size, memory, and time. Pay for a measured improvement, not a bigger folder name.
Duration deserves the same discipline. The official examples generate 8 seconds. Short generations are cheaper, easier to judge, and easier to replace. For beds and intro stings, short is often the job itself. Generate short, listen fully, and extend only survivors. When you go longer, run the same prompt at two durations and find where each breaks. That break point is your working limit on your hardware.
Prompt wording is your cheapest quality lever. MusicGen was trained with English descriptions, so write briefs: genre, mood, tempo feel, instrumentation. “Upbeat indie rock, bright electric guitar, steady drums, cheerful mood” beats “happy rock.” Change one element at a time, or you learn nothing about which change worked. Ten logged generations teach more than fifty forgotten ones.
Step 4: tune the test before you scale it
Once one file plays, run a structured test. Pick one job, such as a bed for a talking-head video. Write three prompts differing in one element each, generate at the same duration on the same model, and listen under actual speech, not solo. Music that impresses alone can fight a voice. Judge it in the mix it will live in.
Check the endings. The model sometimes generates the end of a song and collapses to silence, so a track that starts well can still fail your job. Listen to the last two seconds of every keeper. If you plan to loop a bed, check the loop point by playing the file twice in a row. A bed that cannot loop cleanly forces you to generate longer files and cut them by hand, which is fine when you plan for it and annoying when you discover it at export time. Write the loop verdict in your log beside the prompt.
Test the melody route only if melody control is your job. Melody models accept a melody input plus text, which is powerful for matching an existing tune and one more input to debug. For text-to-music only, stay on text-only models until the workflow is boring. Boring means stable.
Finally, decide your acceptance rule before you generate a batch. For example: a keeper must match the mood, hold its rhythm to the end, sit under speech without masking it, and loop or fade cleanly. Write the rule down. Without a rule, every generation becomes a fresh argument with yourself, and you keep the file you generated last instead of the file that passed. With a rule, a batch of ten generations produces a shortlist in minutes.
First-run security steps you must not skip
A local install feels safe because nothing leaves your machine. Keep it that way with four habits. First, install only from the official package and repository routes in this guide. The stable PyPI package and the facebookresearch GitHub repository are the sources the official docs point to. A random mirror or a repackaged download is not a shortcut; it is an unreviewed code path into your environment. Second, keep the environment isolated. The pinned PyTorch version belongs in this project’s environment, not in your system Python. Isolation limits the blast radius when a dependency misbehaves.
Third, treat model downloads as downloads: use the official facebook model names from the docs, and distrust similarly named uploads from unknown accounts. Fourth, run the Gradio demo locally without its share flag. A share link exposes your machine’s interface beyond your network. Your GPU and files do not need an audience.
Keep prompts and outputs as project files, one folder per project with the log inside. When every file carries its model name and date, you can always answer “where did this track come from?” Provenance is a security habit and a licence habit at once.
Backup and update routine
Back up the things you cannot regenerate: your prompt log, your keeper WAV files, and a record of your environment. The models can be downloaded again. The exact prompt that produced your one good bed cannot. Save the environment record with a package list from inside the activated environment, and note the Python version, the torch version, and the audiocraft version beside it. If the machine dies, that note rebuilds the setup in one sitting instead of an afternoon of version guessing.
Know where models live. Hugging Face caches them, and AUDIOCRAFT_CACHE_DIR can override the AudioCraft cache. Record any custom path in your project note, and check cache size after trying a larger model. Three forgotten checkpoints can eat a drive.
Update with restraint. The stable release is audiocraft 1.3.0 from June 3, 2024; it needs no weekly updates. Before upgrading, export your environment record, finish the current project, and test on the Step 2 proof. If it still writes playable files, keep the upgrade. If not, restore the recorded versions. Never upgrade the night before a deadline.
Common errors and fixes
First, version mismatch. AudioCraft requires Python 3.9 and PyTorch 2.1.0, with torch installed before xformers. If imports fail, confirm the active environment, Python version, and torch version before touching code. Most “MusicGen is broken” reports mean the wrong environment is active. Rebuild cleanly when it is tangled.
The second family is memory. The docs recommend 16 GB of GPU memory and at least 16 GB for medium-sized inference, with smaller GPUs limited to short sequences or the small model. If generation fails with memory errors, shorten the duration first, then step down to the small model, then close other GPU workloads. Do not start by editing library code. Memory errors are the hardware telling you the truth about the model you chose. Listen to it, and the error usually leaves with the smaller model.
Third, missing ffmpeg: if file handling fails, verify ffmpeg is reachable, install it by the system or conda route, and rerun the proof. Fourth, output quality is not an install error. Silence collapse and weak prompt adherence are documented limitations. Fix them with shorter durations and clearer prompts. Do not reinstall the library to fix a brief.
The fifth family is the licence error, and it is the only one that can cost real money. It sounds like this: the track works, the video is ready, and someone asks whether the music can be used commercially. With CC-BY-NC weights, the answer for a business use is no. There is no install fix for that. The fix is upstream: decide the commercial question before you generate, and route commercial jobs to a licensed source from the start.
Tips and tricks that save money
Generate the proof on the small model before you download anything larger. The small model answers the only question that matters on day one: does the chain work on my machine? Every gigabyte you do not download for a failed test is time and disk you keep. Step up to medium or melody only with a comparison test ready, so the larger download buys a measured answer instead of a hope.
Write prompts like briefs, one change at a time. Prompt work is free; GPU and listening time are not. A disciplined log compounds, narrowing the wording that works for recurring jobs like beds under speech.
Keep generations short until a keeper earns length. Eight seconds is enough to judge mood, rhythm, and ending behaviour. Longer files multiply every cost: generation time, listening time, and the pain when the track collapses near the end. Extend the winners. Discard the rest without sentimentality.
Decide the commercial question at the brief stage. If output will promote a business or ship to a client, the weights are the wrong source however good the track sounds. Routing early costs a subscription line. Routing late costs a re-edit and re-upload.
Reuse your environment record. When a second machine or a rebuilt system needs MusicGen, the recorded Python, torch, and audiocraft versions turn setup into a checklist. Teams waste more time rediscovering working version combinations than they ever waste on generation itself.
The real cost maths

MusicGen’s licence maths has two lines, and both matter. The code line is $0: MIT licence, no licence fee. The weights line is also $0 to download, but CC-BY-NC 4.0 grants no commercial use. So for a commercial job, the saving MusicGen offers is not “free music.” It is zero, because the output cannot be used for that job under the released weights licence. Any cost comparison that skips that line is fiction. The honest comparison is: local MusicGen for non-commercial work at $0 licence cost plus your hardware, versus a paid plan that grants commercial rights.
Suno’s official pricing page on December 6, 2026 showed a Free plan at $0 per month with 50 song credits per day, no monthly song downloads, and no commercial rights. The Pro plan showed $10 per month on monthly billing, or $8 per month billed yearly, with 2,500 song credits per month, 20 song downloads per month, and commercial use rights.
The Premier plan showed $30 per month monthly, or $24 per month billed yearly, with 10,000 song credits per month, 60 song downloads per month, and commercial use rights. The page notes that paid plans auto-renew, can be cancelled anytime, and that taxes are calculated at checkout, so treat the shown prices as pre-tax.
Now run one realistic scenario. A small creator publishes four business videos a month and wants one background track per video, with commercial rights.
MusicGen cannot supply those four tracks commercially under its weights licence, so its cost for this job is not $0; it is disqualified. Suno Pro at $10 per month covers the job inside its 20 monthly downloads, which is $120 over twelve months on monthly billing, or $96 over a year at the $8 billed-yearly rate before tax. That is the real commercial comparison: $96 to $120 a year for licensed output, versus a local install that is excellent for learning and private tests but cannot carry the business videos.
Run the second scenario. A hobbyist or student generates twenty private experiments a month, publishes nothing commercially, and already owns a GPU with enough memory. MusicGen’s licence cost is $0, the subscription cost is $0, and the real costs are the hardware already bought, electricity, and listening time. Against Suno Pro at $10 per month, the local install saves $120 a year for this non-commercial job. Both scenarios are true at once. The licence decides which scenario you are in. Price the job you actually have, not the job you wish the licence allowed.
Hidden costs sit on both sides: locally, GPU limits, download size, generation and review time; on a paid plan, download caps, credits, auto-renewal, and checkout tax. Pro’s 20 downloads suit four videos a month and pinch a daily uploader. Count monthly keepers before choosing a tier.
| Route | Licence cost | Commercial use | What limits you |
|---|---|---|---|
| AudioCraft code | $0, MIT | Code yes, weights no | Your GPU and time |
| MusicGen weights | $0 download, CC-BY-NC 4.0 | No | Non-commercial only |
| Suno Free | $0 per month | No | 50 credits a day, no downloads |
| Suno Pro | $10 monthly, $8 billed yearly | Yes | 20 downloads a month |
| Suno Premier | $30 monthly, $24 billed yearly | Yes | 60 downloads a month |
When not to install AudioCraft MusicGen
Do not install MusicGen as your commercial music source. If the output will advertise a business, sit inside a client deliverable, or monetise a channel as business content, the CC-BY-NC weights licence blocks the job. Install it to learn, to test, and to make private work. Buy commercial rights for commercial work. That boundary is not a flaw in the tool. It is the terms on which Meta released the weights, stated on the repository and the model card in plain sight.
Do not install it without a suitable GPU: local use requires one, 16 GB is recommended, and smaller cards are limited to short sequences or the small model. Do not install it for vocals โ it cannot generate realistic vocals. Do not expect every style and culture to perform equally. Test your style early and believe the test.
Do not install it when you need finished, mastered, loop-perfect tracks with no review time. MusicGen produces samples you must listen to, trim, and judge. If your workflow has no listening step, no generative music tool belongs in it, local or paid. Review time is part of the cost on every route in this guide.
Pros and cons
The strengths are real. The code is MIT with a $0 licence fee, the install is official and documented, and generation runs locally so prompts and test files stay on your machine. Five model sizes and variants let you match the download to your GPU, melody models add guided generation, and the audio_write helper normalises loudness for consistent test files. For research and private work, that is a strong, honest toolkit.
The weaknesses are equally real. The weights are CC-BY-NC 4.0, so commercial use is out. Local use requires a GPU, with 16 GB recommended for the medium models. The model cannot produce realistic vocals, performs unevenly across styles and cultures, sometimes collapses to silence, and needs prompt engineering to behave. The stable package dates from June 2024, so expect a research library’s pace, not a consumer app’s polish. Every output needs a human listen before it goes anywhere.
Our verdict
Install audiocraft musicgen when your job is local, non-commercial music generation you will review by ear. Match Python 3.9 and PyTorch 2.1.0, install torch before the package, prove one 8-second WAV on the small model, and step up in size only with a comparison test ready. MusicGen earns its place as a private test bench: $0 code licence, local files, real text-to-music control. It does not earn a place as a business music library, because the released weights are CC-BY-NC 4.0 and grant no commercial use. That single licence line decides the purchase. Learn locally with MusicGen. Publish commercially with licensed music.
FAQ
Is MusicGen free for commercial use?
No. The AudioCraft code is MIT, but the MusicGen model weights are released under CC-BY-NC 4.0, which is a non-commercial licence. You can install and generate locally for research and private work. Business videos, ads, and client work need a source that grants commercial rights.
What GPU do I need to install AudioCraft MusicGen?
The official docs say local use requires a GPU and recommend 16 GB of memory. Medium-sized models of about 1.5B parameters need at least 16 GB for inference. Smaller GPUs can generate short sequences, or longer sequences with the 300M small model.
Which Python and PyTorch versions does AudioCraft require?
AudioCraft requires Python 3.9 and PyTorch 2.1.0. The official instructions say to install torch first, in particular before xformers, then install setuptools and wheel, then install the audiocraft package. Match those versions for a first install.
Can MusicGen generate vocals or lyrics?
No. The model card states the model is not able to generate realistic vocals, and the training data had vocals removed through source separation. MusicGen generates instrumental music samples from text or melody conditioning. Jobs that need singing need a different tool.
Why does my MusicGen track collapse to silence?
The model card lists this as a known limitation: the model sometimes generates the end of a song, collapsing to silence. Shorten the duration, sharpen the English prompt, and listen to the ending of every keeper. Treat the collapse point as your working limit for that model and prompt.
Strategic Pivot
Before you turn a local music test into a buying decision, run the ownership maths beside your other AI tools. Use our free AI Cost Calculator to compare a $0 local MusicGen setup for private work against the paid commercial plan your business output actually needs. Put the licence line in the same note as the price. A cheap track is useful only when you are allowed to publish it.
Sources
Price note โ updated December 6, 2026: Prices in this post were checked on December 6, 2026. When you are reading this, the price may be lower or higher. Check the official pricing page before buying.
Pros
- MIT code licence with $0 licence fee
- local generation keeps prompts and files on your machine
- model sizes from 300M to 3.3B match different GPUs
- melody models add guided generation
- official install route with pinned versions
- short generations make quality tests cheap
Cons
- model weights are CC-BY-NC 4.0, so no commercial use
- local use requires a GPU with 16 GB recommended
- cannot generate realistic vocals
- performance varies across styles and cultures
- output can collapse to silence
- every track needs a human listen
Install audiocraft musicgen when your job is local, non-commercial music generation you will review by ear. Match Python 3.9 and PyTorch 2.1.0, install torch before the package, and prove one 8-second WAV on the small model. MusicGen earns its place as a private test bench with a $0 code licence and local files. It does not earn a place as a business music library, because the released weights are CC-BY-NC 4.0 and grant no commercial use. That single licence line decides the purchase. Learn locally with MusicGen. Publish commercially with licensed music.

1 thought on “How to Install AudioCraft MusicGen AI Music Generator (2026)”