随着 AI 的应用日益广泛,各种 AI 程序已经融入我们的日常生活。从最早的写作,到医疗、教育,如今甚至扩展到了音乐领域。
Suno 是一个专注于高质量 AI 歌曲和音乐创作的平台。用户只需输入简单的文本提示词,便可以按照流派风格和歌词生成包含人声的歌曲。这个 AI 音乐生成器由 Meta、TikTok、Kensho 等知名科技公司的团队打造,旨在不依赖任何乐器工具的情况下,让每个人都能创作出美妙的音乐。
Suno 的音乐生成模型已经更新到了 V3 版本,能够生成长度达 2 分钟的歌曲。
然而,Suno 官方并没有提供 API,而 AceDataCloud 为 Suno 提供了一套模拟对接的 API,让音乐生成变得方便快捷。
如何申请和使用
要使用 Suno Audios API,可以先访问 Suno Audios Generation API 页面,点击“Acquire”按钮,即可获得请求所需的凭证:
如果您还没有登录或注册,页面会自动跳转,请您注册和登录。完成后会自动返回到当前页面。
初次申请时,会赠送免费使用额度。
基本用法
想做些什么歌曲,只需要随意输入一段文字。比如想生成一首关于圣诞节的歌曲,输入 a song for Christmas
即可,如下图所示:
生成的代码如下:
您可以直接点击“Try”按钮测试 API,等待 1-2 分钟,就会得到结果:
{
"success": true,
"data": [
{
"id": "2f16f7bc-4135-42c6-b3c5-6d6c49dc8cd5",
"title": "Winter Wonderland",
"image_url": "https://cdn1.suno.ai/image_2f16f7bc-4135-42c6-b3c5-6d6c49dc8cd5.png",
"lyric": "[Verse]\nSnowflakes falling all around\nGlistening white\nCovering the ground\nChildren laughing\nFull of delight\nIn this winter wonderland tonight\nSanta's sleigh\nUp in the sky\nRudolph's nose shining bright\nOh my\nHear the jingle bells\nRinging so clear\nBringing joy and holiday cheer\n[Verse 2]\nRoasting chestnuts by the fire's glow\nChristmas lights\nThey twinkle and show\nFamilies gathering with love and cheer\nSpreading warmth to everyone near",
"audio_url": "https://cdn1.suno.ai/2f16f7bc-4135-42c6-b3c5-6d6c49dc8cd5.mp3",
"video_url": "https://cdn1.suno.ai/2f16f7bc-4135-42c6-b3c5-6d6c49dc8cd5.mp4",
"created_at": "2024-05-10T16:21:37.624Z",
"model": "chirp-v3",
"prompt": "A song for Christmas",
"style": "holiday"
},
{
"id": "5dca232b-17cc-4896-a2d1-4b59178bf410",
"title": "Winter Wonderland",
"image_url": "https://cdn1.suno.ai/image_5dca232b-17cc-4896-a2d1-4b59178bf410.png",
"lyric": "[Verse]\nSnowflakes falling all around\nGlistening white\nCovering the ground\nChildren laughing\nFull of delight\nIn this winter wonderland tonight\nSanta's sleigh\nUp in the sky\nRudolph's nose shining bright\nOh my\nHear the jingle bells\nRinging so clear\nBringing joy and holiday cheer\n[Verse 2]\nRoasting chestnuts by the fire's glow\nChristmas lights\nThey twinkle and show\nFamilies gathering with love and cheer\nSpreading warmth to everyone near",
"audio_url": "https://cdn1.suno.ai/5dca232b-17cc-4896-a2d1-4b59178bf410.mp3",
"video_url": "https://cdn1.suno.ai/5dca232b-17cc-4896-a2d1-4b59178bf410.mp4",
"created_at": "2024-05-10T16:21:37.624Z",
"model": "chirp-v3",
"prompt": "A song for Christmas",
"style": "holiday"
}
]
}
看到这里,我们得到了两首歌曲的详细信息,包括标题、封面图、歌词、音频和视频等内容。
字段说明如下:
- success:生成是否成功,成功时为
true
,失败则为false
- data:列表,包含生成的歌曲详细信息
- id:歌曲的 ID
- title:歌曲标题
- image_url:歌曲封面图片链接
- lyric:歌词
- audio_url:音频文件链接,点击即可播放
- video_url:视频文件链接,点击即可播放
- created_at:创建时间
- model:使用的模型,一般是最新的 V3 模型
- style:风格
自定义生成
假如想自定义歌词,只需输入希望的歌词:
此时 lyric
字段可以填入以下内容:
[Verse]\nSnowflakes falling all around\nGlistening white\nCovering the ground\nChildren laughing\nFull of delight\nIn this winter wonderland tonight\nSanta's sleigh\nUp in the sky\nRudolph's nose shining bright\nOh my\nHear the jingle bells\nRinging so clear\nBringing joy and holiday cheer\n[Verse 2]\nRoasting chestnuts by the fire's glow\nChristmas lights\nThey twinkle and show\nFamilies gathering with love and cheer\nSpreading warmth to everyone near
注意,这里的歌词中
\n
是换行符。如果您不知如何创作歌词,可以使用 AceDataCloud 提供的 Suno Lyrics Generation API 通过 prompt 生成歌词。
接下来我们想根据歌词、标题和风格自定义生成歌曲,如此指定内容:
- lyric:歌词文本
- custom:设为
true
表示自定义生成,此参数默认false
表示使用prompt
生成。 - file:歌曲标题
- style:歌曲风格(可选)
填写样例如下:
完成后自动生成代码如下:
生成的代码为:
curl -X POST 'https://api.acedata.cloud/suno/audios' \
-H 'authorization: Bearer {token}' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-d '{
"lyric": "[Verse]\\nSnowflakes falling all around\\nGlistening white\\nCovering the ground\\nChildren laughing\\nFull of delight\\nIn this winter wonderland tonight\\nSanta's sleigh\\nUp in the sky\\nRudolph's nose shining bright\\nOh my\\nHear the jingle bells\\nRinging so clear\\nBringing joy and holiday cheer\\n[Verse 2]\\nRoasting chestnuts by the fire's glow\\nChristmas lights\\nThey twinkle and show\\nFamilies gathering with love and cheer\\nSpreading warmth to everyone near",
"custom": true
}'
进行测试,生成效果相似。
继续生成功能
如果希望对生成的歌曲进行继续生成,可以将 action
参数设为 extend
,并输入需要继续生成的歌曲 ID。获取歌曲 ID 的方式可参考基本使用部分,如下图所示:
此时看到歌曲的 ID 如下:
"id": "b9