patrickvonplaten
commited on
Commit
•
cbf68c9
1
Parent(s):
241e3fb
Update README.md
Browse files
README.md
CHANGED
@@ -49,13 +49,15 @@ apt get install ffmpeg
|
|
49 |
import torchaudio
|
50 |
from audiocraft.models import MusicGen
|
51 |
from audiocraft.data.audio import audio_write
|
52 |
-
|
|
|
53 |
model.set_generation_params(duration=8) # generate 8 seconds.
|
|
|
54 |
wav = model.generate_unconditional(4) # generates 4 unconditional audio samples
|
55 |
descriptions = ['happy rock', 'energetic EDM', 'sad jazz']
|
|
|
56 |
wav = model.generate(descriptions) # generates 3 samples.
|
57 |
-
|
58 |
-
# generates using the melody from the given audio and the provided descriptions.
|
59 |
wav = model.generate_with_chroma(descriptions, melody[None].expand(3, -1, -1), sr)
|
60 |
for idx, one_wav in enumerate(wav):
|
61 |
# Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
|
|
|
49 |
import torchaudio
|
50 |
from audiocraft.models import MusicGen
|
51 |
from audiocraft.data.audio import audio_write
|
52 |
+
|
53 |
+
model = MusicGen.get_pretrained('small')
|
54 |
model.set_generation_params(duration=8) # generate 8 seconds.
|
55 |
+
|
56 |
wav = model.generate_unconditional(4) # generates 4 unconditional audio samples
|
57 |
descriptions = ['happy rock', 'energetic EDM', 'sad jazz']
|
58 |
+
|
59 |
wav = model.generate(descriptions) # generates 3 samples.
|
60 |
+
|
|
|
61 |
wav = model.generate_with_chroma(descriptions, melody[None].expand(3, -1, -1), sr)
|
62 |
for idx, one_wav in enumerate(wav):
|
63 |
# Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
|