File size: 3,798 Bytes
08e8b48
6b0efbf
 
2e3d0b6
6b0efbf
e37de3a
 
 
 
2e3d0b6
 
 
 
e37de3a
08e8b48
 
2e3d0b6
08e8b48
7b5a668
08e8b48
7386a58
 
ccf856f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee57199
 
 
 
 
 
 
 
 
ccf856f
 
 
 
 
 
 
 
ee57199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
---
inference: true
pipeline_tag: text-to-audio
library_name: audiocraft
widget:
- text: hip hop, soul, piano, chords, jazz, neo jazz, G# minor, 140 bpm
  example_title: Prompt 1
- text: music, hip hop, soul, rnb, neo soul, C# major, 80 bpm
  example_title: Prompt 2
language: en
tags:
- text-to-audio
- musicgen
license: cc-by-nc-4.0
---

# Model Card for musicgen-songstarter-v0.1

musicgen-songstarter-v0.1 is a [`musicgen-melody`](https://huggingface.co/facebook/musicgen-melody) 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.

This is a proof of concept. Hopefully, we will be able to collect more data and train a better models in the future.

## 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
from audiocraft.models import musicgen

model = musicgen.MusicGen.get_pretrained('nateraw/musicgen-songstarter-v0.1', device='cuda')
```

To generate and save audio samples, you can do:

```python
from datetime import datetime
from pathlib import Path

from audiocraft.models import musicgen
from audiocraft.data.audio import audio_write
from audiocraft.utils.notebook import display_audio

model = musicgen.MusicGen.get_pretrained('nateraw/musicgen-songstarter-v0.1', device='cuda')

# path to save our samples.
out_dir = Path("./samples")
out_dir.mkdir(exist_ok=True, parents=True)

model.set_generation_params(
    duration=15,
    use_sampling=True,
    temperature=1.0,
    top_k=250,
    cfg_coef=3.0,
)

text = "hip hop, soul, piano, chords, jazz, neo jazz, G# minor, 140 bpm"
N = 4
out = model.generate(
    [text] * N,
    progress=True,
)

# Write to files
dt_str = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
for i in range(N):
    audio_write(
        out_dir / f"{dt_str}_{i:02d}",
        out[i].cpu(),
        model.sample_rate,
        strategy="loudness",
    )

# Or, if in a notebook, display audio widgets
# display_audio(out, model.sample_rate)
```

## Prompt Format

Follow the following prompt format:

```
{tag_1}, {tag_1}, ..., {tag_n}, {key}, {bpm} bpm
```

For example:

```
hip hop, soul, piano, chords, jazz, neo jazz, G# minor, 140 bpm
```

The training dataset had the following tags in it:

```
hip hop
trap
soul
rnb
synth
songstarters
melody
keys
chords
guitar
vocals
dancehall
melodic stack
piano
electric
layered
music
drill
lo-fi hip hop
cinematic
pop
resampled
afropop & afrobeats
strings
leads
dark
african
acoustic
brass & woodwinds
live sounds
reggaeton
boom bap
pads
electric piano
fx
downtempo
wet
electric guitar
lo-fi
caribbean
chops
chillout
riffs
percussion
electronic
bass
choir
arp
uk drill
female
plucks
future bass
processed
future soul
ensemble
mallets
hooks
uk
flute
phrases
drums
atmospheres
jazz
emo
gospel
male
reverse
latin american
trap edm
latin
bells
pitched
ambient
tonal
distorted
moombahton
vinyl
orchestral
dry
psychedelic
edm
funk
neo soul
classical
harmony
adlib
trumpet
high
horns
electronica
violin
808
synthwave
ngoni
house
drones
progressive house
g-funk
hats
trip hop
baile funk
filtered
doo wop
tambourine
kora
stabs
textures
claps
grooves
clean
analog
harp
ambience
smooth
acapella
blues
saxophone
organ
soft
tremolo
chillwave
reverb
electric bass
low
moog
wah
wobble
indie pop
modular
sub
indie dance
glide
k-pop
afrobeat
mid
balafon
bitcrushed
phaser
middle eastern
zither
shakers
delay
tech house
disco
experimental
celesta
cello
drum and bass
trance
rock
rhythm
whistle
sidechained
saw
breakbeat
techno
brazilian
music box
glitch
clarinet
```