andreasjansson / musicgen-looper

Generate fixed-bpm loops from text prompts

  • Public
  • 45.7K runs
  • GitHub
  • Paper
  • License

Input

Output

Run time and cost

This model runs on Nvidia A100 (40GB) GPU hardware. Predictions typically complete within 3 minutes. The predict time for this model varies significantly based on the inputs.

Readme

MusicGen-Looper

Generate fixed-bpm loops from text prompts

How it works

First a piece of music is generated by running the prompt (appending ", {bpm} bpm") through MusicGen. Then BeatNet detects beats and downbeats. An even number of bars is extracted from the output audio.

Variations are created by using MusicGen’s continuation feature, passing the last bar of the first variation as input to the continuation model.

All variations are time stretched with Rubberband to match the requested tempo exactly. If the actual tempo of the first variation is +/-10 bpm from the requested tempo, an error is thrown.

Failure cases

  • BeatNet often struggles to pick the right downbeat, which causes loops to start on a different beat than 1.
  • MusicGen has its own limitations, e.g. it can’t generate vocals