背景音乐搜索 (BGM Search)
基于 Freesound API 搜索免费背景音乐,支持按关键词、情绪、场景等条件搜索。
快速开始
获取 API Key
- 访问 https://freesound.org/apiv2/apply
- 注册账号并申请 API credential
- 获取 Client ID 和 API Key
环境配置
在项目根目录 .env 文件中添加:
FREESOUND_API_KEY=your_api_key
基础使用
cd .claude/skills/bgm-search
python scripts/search.py "happy upbeat"
按场景搜索
# 搜索欢快背景音乐
python scripts/search.py "cheerful background" --duration 60-180
# 搜索科技感音乐
python scripts/search.py "technology electronic" --tag music
# 搜索轻松氛围音乐
python scripts/search.py "relaxing ambient" --limit 5
下载音乐
# 搜索并下载第一个结果
python scripts/search.py "cinematic epic" --download --output ./bgm/
# 下载指定 ID 的音乐
python scripts/download.py 12345 --output ./bgm/epic.mp3
工作流建议
当用户需要背景音乐时,遵循以下流程:
Step 1: 理解需求
与用户确认:
- 视频/内容的主题和氛围
- 期望的音乐风格(欢快、悲伤、紧张、轻松等)
- 音乐时长要求
- 是否需要循环播放
Step 2: 构建搜索词
根据需求转换为英文搜索关键词:
- 欢快 → happy, cheerful, upbeat
- 悲伤 → sad, melancholy, emotional
- 紧张 → tense, suspense, dramatic
- 轻松 → relaxing, calm, peaceful
- 科技 → technology, electronic, digital
- 史诗 → epic, cinematic, orchestral
Step 3: 执行搜索
python scripts/search.py "关键词" --tag music --duration 60-300 --limit 10
Step 4: 返回结果
将搜索结果返回给用户,包括:
- 音乐名称和预览链接
- 时长和格式信息
- 许可证类型
- 下载链接
命令行参数
| 参数 |
说明 |
默认值 |
| query |
搜索关键词(英文) |
必填 |
| --tag |
筛选标签,如 music, ambient |
无 |
| --duration |
时长范围,如 60-180(秒) |
无 |
| --limit |
返回结果数量 |
5 |
| --sort |
排序方式: rating, downloads, duration |
rating |
| --download |
下载搜索到的音乐 |
false |
| --output |
下载保存目录 |
./downloads |
常用搜索词
情绪类
| 中文 |
英文关键词 |
| 欢快 |
happy, cheerful, upbeat, joyful |
| 悲伤 |
sad, melancholy, emotional, sorrowful |
| 紧张 |
tense, suspense, thriller, dramatic |
| 轻松 |
relaxing, calm, peaceful, chill |
| 浪漫 |
romantic, love, gentle, tender |
| 激励 |
inspiring, motivational, uplifting |
风格类
| 中文 |
英文关键词 |
| 科技 |
technology, electronic, digital, futuristic |
| 史诗 |
epic, cinematic, orchestral, dramatic |
| 爵士 |
jazz, smooth, swing |
| 古典 |
classical, piano, orchestra |
| 摇滚 |
rock, guitar, energetic |
| 氛围 |
ambient, atmospheric, soundscape |
场景类
| 中文 |
英文关键词 |
| 片头 |
intro, opening, logo |
| 背景 |
background, underscore |
| 游戏 |
game, 8bit, retro |
| 自然 |
nature, forest, ocean |
| 城市 |
urban, city, street |
许可证说明
Freesound 上的音频采用 Creative Commons 许可证:
- CC0: 公共领域,可自由使用
- CC BY: 需署名作者
- CC BY-NC: 需署名,仅限非商业用途
使用时请注意查看具体许可证要求。
依赖安装
cd .claude/skills/bgm-search
pip install -r scripts/requirements.txt
在 Claude Code 中使用
直接说:
帮我找一段欢快的背景音乐
搜索适合科技视频的背景音乐
找一段 2 分钟左右的轻松氛围音乐
Claude 会自动调用该 skill 搜索并返回结果。
API 文档
1---2name: bgm-search3description: 搜索免费背景音乐,支持按关键词、情绪、场景搜索,基于 Freesound API。4---56# 背景音乐搜索 (BGM Search)78基于 Freesound API 搜索免费背景音乐,支持按关键词、情绪、场景等条件搜索。910## 快速开始1112### 获取 API Key13141. 访问 https://freesound.org/apiv2/apply152. 注册账号并申请 API credential163. 获取 Client ID 和 API Key1718### 环境配置1920在项目根目录 `.env` 文件中添加:2122```bash23FREESOUND_API_KEY=your_api_key24```2526### 基础使用2728```bash29cd .claude/skills/bgm-search30python scripts/search.py "happy upbeat"31```3233### 按场景搜索3435```bash36# 搜索欢快背景音乐37python scripts/search.py "cheerful background" --duration 60-1803839# 搜索科技感音乐40python scripts/search.py "technology electronic" --tag music4142# 搜索轻松氛围音乐43python scripts/search.py "relaxing ambient" --limit 544```4546### 下载音乐4748```bash49# 搜索并下载第一个结果50python scripts/search.py "cinematic epic" --download --output ./bgm/5152# 下载指定 ID 的音乐53python scripts/download.py 12345 --output ./bgm/epic.mp354```5556## 工作流建议5758当用户需要背景音乐时,遵循以下流程:5960### Step 1: 理解需求6162与用户确认:63- 视频/内容的主题和氛围64- 期望的音乐风格(欢快、悲伤、紧张、轻松等)65- 音乐时长要求66- 是否需要循环播放6768### Step 2: 构建搜索词6970根据需求转换为英文搜索关键词:71- 欢快 → happy, cheerful, upbeat72- 悲伤 → sad, melancholy, emotional73- 紧张 → tense, suspense, dramatic74- 轻松 → relaxing, calm, peaceful75- 科技 → technology, electronic, digital76- 史诗 → epic, cinematic, orchestral7778### Step 3: 执行搜索7980```bash81python scripts/search.py "关键词" --tag music --duration 60-300 --limit 1082```8384### Step 4: 返回结果8586将搜索结果返回给用户,包括:87- 音乐名称和预览链接88- 时长和格式信息89- 许可证类型90- 下载链接9192## 命令行参数9394| 参数 | 说明 | 默认值 |95|------|------|--------|96| query | 搜索关键词(英文) | 必填 |97| --tag | 筛选标签,如 music, ambient | 无 |98| --duration | 时长范围,如 60-180(秒) | 无 |99| --limit | 返回结果数量 | 5 |100| --sort | 排序方式: rating, downloads, duration | rating |101| --download | 下载搜索到的音乐 | false |102| --output | 下载保存目录 | ./downloads |103104## 常用搜索词105106### 情绪类107| 中文 | 英文关键词 |108|------|-----------|109| 欢快 | happy, cheerful, upbeat, joyful |110| 悲伤 | sad, melancholy, emotional, sorrowful |111| 紧张 | tense, suspense, thriller, dramatic |112| 轻松 | relaxing, calm, peaceful, chill |113| 浪漫 | romantic, love, gentle, tender |114| 激励 | inspiring, motivational, uplifting |115116### 风格类117| 中文 | 英文关键词 |118|------|-----------|119| 科技 | technology, electronic, digital, futuristic |120| 史诗 | epic, cinematic, orchestral, dramatic |121| 爵士 | jazz, smooth, swing |122| 古典 | classical, piano, orchestra |123| 摇滚 | rock, guitar, energetic |124| 氛围 | ambient, atmospheric, soundscape |125126### 场景类127| 中文 | 英文关键词 |128|------|-----------|129| 片头 | intro, opening, logo |130| 背景 | background, underscore |131| 游戏 | game, 8bit, retro |132| 自然 | nature, forest, ocean |133| 城市 | urban, city, street |134135## 许可证说明136137Freesound 上的音频采用 Creative Commons 许可证:138- **CC0**: 公共领域,可自由使用139- **CC BY**: 需署名作者140- **CC BY-NC**: 需署名,仅限非商业用途141142使用时请注意查看具体许可证要求。143144## 依赖安装145146```bash147cd .claude/skills/bgm-search148pip install -r scripts/requirements.txt149```150151## 在 Claude Code 中使用152153直接说:154155```156帮我找一段欢快的背景音乐157搜索适合科技视频的背景音乐158找一段 2 分钟左右的轻松氛围音乐159```160161Claude 会自动调用该 skill 搜索并返回结果。162163## API 文档164165- Freesound API: https://freesound.org/docs/api/166- 申请 API Key: https://freesound.org/apiv2/apply