File size: 2,448 Bytes
c138056 a778c94 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
---
pipeline_tag: text-to-audio
library_name: audiocraft
language: en
tags:
- text-to-audio
- musicgen
- songstarter
license: cc-by-nc-4.0
---
# Model Card for musicgen-songstarter-v0.2
musicgen-songstarter-v0.2 is a [`musicgen-stereo-melody-large`](https://huggingface.co/facebook/musicgen-stereo-melody-large) fine-tuned on a dataset of melody loops from my Splice sample library. It's intended to be used to generate song ideas that are useful for music producers. It generates stereo audio in 32khz.
## Usage
Install [audiocraft](https://github.com/facebookresearch/audiocraft):
```
pip install -U git+https://github.com/facebookresearch/audiocraft#egg=audiocraft
```
Then, you should be able to load this model just like any other musicgen checkpoint here on the Hub:
```python
import torchaudio
from audiocraft.models import MusicGen
from audiocraft.data.audio import audio_write
model = MusicGen.get_pretrained('nateraw/musicgen-songstarter-v0.2')
model.set_generation_params(duration=8) # generate 8 seconds.
wav = model.generate_unconditional(4) # generates 4 unconditional audio samples
descriptions = ['acoustic, guitar, melody, trap, d minor, 90 bpm'] * 3
wav = model.generate(descriptions) # generates 3 samples.
melody, sr = torchaudio.load('./assets/bach.mp3')
# generates using the melody from the given audio and the provided descriptions.
wav = model.generate_with_chroma(descriptions, melody[None].expand(3, -1, -1), sr)
for idx, one_wav in enumerate(wav):
# Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
audio_write(f'{idx}', one_wav.cpu(), model.sample_rate, strategy="loudness", loudness_compressor=True)
```
## Samples
<table>
<tr>
<td>
<audio controls>
<source src="./assets/bach.wav" type="audio/wav">
Your browser does not support the audio element.
</audio>
</td>
<td>
<audio controls>
<source src="./assets/bach_guitar.wav" type="audio/wav">
Your browser does not support the audio element.
</audio>
</td>
</tr>
<tr>
<td>
<audio controls>
<source src="./assets/kalhonaho.wav" type="audio/wav">
Your browser does not support the audio element.
</audio>
</td>
<td>
<audio controls>
<source src="./assets/kalhonaho_trap.wav" type="audio/wav">
Your browser does not support the audio element.
</audio>
</td>
</tr>
</table> |