見出し画像

音楽の生成AI MusicGenを試す

イントロダクション

人工知能が日々進化している今日、私たちはその恩恵を様々な形で受けています。その中でも特に注目すべき進化を遂げているのが、創造的なタスクへのAIの応用です。今回は、音楽の生成AI「MusicGen」を試してみました。MusicGenは、ユーザーからのプロンプトを元にオリジナルの音楽を生成することができます。

ChatGPTを使って、プロンプトを作成

好きなアーティストのスタイルを再現できるか試します

User: Could you explain Bonobo's music style to me?

Assistant: Bonobo, or Simon Green, is a British musician known for his unique blend of electronic and trip-hop music. His style features downtempo beats, atmospheric soundscapes, and organic elements like strings and piano. Many of his tracks have complex arrangements and a cinematic quality, evoking a sense of journey or exploration. Each of his songs can have unique characteristics, and his style has evolved over time.

User: I'd like to create a music track in the style of Bonobo. Can you provide some guidance?

Assistant: To emulate Bonobo's style, consider the following elements:

  1. Atmospheric Soundscapes: Create dense, immersive soundscapes that convey mood or emotion. Use ambient synth pads, reverb, delay, and other effects.

  2. Organic and Acoustic Elements: Incorporate acoustic and organic elements like strings, piano, and various percussion instruments.

  3. Complex Arrangements: Layer different sounds and instruments to create rich, intricate arrangements.

  4. Downtempo Beats: Use slower beats per minute (BPM), typically in the range of 90-120 BPM.

  5. Cinematic Quality: Structure your tracks to evolve and progress over time, creating a sense of journey or progression.

  6. Sampling: Learn to effectively sample and incorporate sounds like vocal snippets, nature sounds, or pieces from other songs.

User: Can you summarize how to create music in the style of Bonobo?

Assistant: To create music in the style of Bonobo, consider building atmospheric soundscapes with ambient synth pads, reverb, and delay. Incorporate organic and acoustic elements like strings and piano, and create complex, layered arrangements. Use downtempo beats with a BPM in the range of 90-120, and structure your tracks to have a cinematic, journey-like progression. Lastly, learn to effectively sample sounds, be it vocal snippets, nature sounds, or pieces from other songs.


MusicGenを試す

!python3 -m pip install -U git+https://github.com/facebookresearch/audiocraft#egg=audiocraft
# !python3 -m pip install -U audiocraft


from audiocraft.models import musicgen
from audiocraft.utils.notebook import display_audio
import torch


model = musicgen.MusicGen.get_pretrained('large', device='cuda')
model.set_generation_params(duration=22, use_sampling=True)


res = model.generate([
    'dance music, consider building atmospheric soundscapes with ambient synth pads, reverb, and delay. Incorporate organic and acoustic elements like strings and piano, and create complex, layered arrangements. Use downtempo beats with a BPM in the range of 90-120, and structure your tracks to have a cinematic, journey-like progression. Lastly, learn to effectively sample sounds, be it vocal snippets, nature sounds, or pieces from other songs.'
    ],  
    progress=True)
display_audio(res, 32000)

詳しくはリポジトリを参照してください
https://github.com/facebookresearch/audiocraft

いいなと思ったら応援しよう!