Coding

Doubao Genbgm

Try it

Based on the Volcano Engine Doubao Music Generation API, supports instrumental BGM generation and vocal song generation.

What it does

Based on the Volcano Engine Doubao Music Generation API, a single script supports two modes: **BGM Mode**: Text description -> instrumental background music (no vocals) **Song Mode**: Prompt or lyrics -> complete vocal song

The skill document

Doubao Music Generation Skill

Based on the Volcano Engine Doubao Music Generation API, a single script supports two modes:

  • BGM Mode: Text description -> instrumental background music (no vocals)
  • Song Mode: Prompt or lyrics -> complete vocal song

Prerequisites

1. Install Dependencies

pip install requests

2. Configure Authentication

# Edit .env and fill in your Volcano Engine AccessKey and SecretKey
export VOLC_ACCESS_KEY=$VOLC_ACCESS_KEY

# 火山引擎 Secret Access Key(必填)
export VOLC_SECRET_KEY=$VOLC_SECRET_KEY

Obtain your AccessKeyId and SecretAccessKey from the Volcano Engine Console -> Key Management.


1. Instrumental BGM Generation

# Basic BGM generation
python3 scripts/gen_music.py \
  --mode bgm \
  --text "Cafe light music, piano and guitar, relaxing and healing, 60 seconds" \
  --output cafe_bgm.mp3

# Specify duration and format
python3 scripts/gen_music.py \
  --mode bgm \
  --text "Epic cinematic soundtrack, string ensemble with brass, magnificent and awe-inspiring" \
  --duration 90 \
  --format wav \
  --output epic.wav

# Use structured segments (v5.0)
python3 scripts/gen_music.py \
  --mode bgm \
  --text "Electronic dance music, EDM style, energetic" \
  --segments '[{"Name":"intro","Duration":10},{"Name":"chorus","Duration":30},{"Name":"outro","Duration":10}]' \
  --output edm_bgm.mp3

# Enable prompt rewrite (improves results)
python3 scripts/gen_music.py \
  --mode bgm \
  --text "Sports video soundtrack" \
  --rewrite \
  --duration 60 \
  --output sport.mp3

2. Vocal Song Generation

# Generate song from prompt
python3 scripts/gen_music.py \
  --mode song \
  --prompt "A song about summer and the seaside, lighthearted and cheerful" \
  --genre "Pop" \
  --mood "Happy" \
  --gender Female \
  --output summer.mp3

# Generate song from lyrics (v4.3, fine-grained control)
python3 scripts/gen_music.py \
  --mode song \
  --lyrics "[verse]
I remember that day, the day we fell in love
Promised each other we'd never say goodbye
[chorus]
The day I gave my heart to you
You disappeared before my eyes" \
  --model-version v4.3 \
  --genre "Folk" \
  --mood "Sentimental/Melancholic/Lonely" \
  --gender Female \
  --timbre "Ethereal" \
  --output folk_song.mp3

# Read lyrics from file
python3 scripts/gen_music.py \
  --mode song \
  --lyrics-file my_lyrics.txt \
  --genre "Chinese Style" \
  --mood "Dreamy/Ethereal" \
  --output guofeng.mp3

# Fine-grained control (key/tempo/instruments)
python3 scripts/gen_music.py \
  --mode song \
  --prompt "Jazz-style urban life" \
  --model-version v4.3 \
  --genre "Jazz" \
  --mood "Chill" \
  --gender Male \
  --timbre "Magnetic" \
  --key "C" \
  --kmode "Major" \
  --tempo "Moderato" \
  --instrument "Saxophone,Acoustic_Piano,Bass" \
  --scene "Coffee Shop,Evening" \
  --output jazz_city.mp3

# English song
python3 scripts/gen_music.py \
  --mode song \
  --prompt "A song about chasing dreams and never giving up" \
  --model-version v4.3 \
  --genre "Pop Rock" \
  --mood "Inspirational/Hopeful" \
  --gender Male \
  --lang English \
  --output dream.mp3

Parameter Reference

Common Parameters

ParameterDescriptionDefault
--modebgm=instrumental, song=vocal songbgm
--billingprepaid=prepaid, postpaid=postpaidpostpaid
--durationDuration in seconds; BGM: [30,120], Song: [30,240]60
--formatOutput format mp3 / wavmp3
--outputOutput file pathoutput.mp3
--poll-intervalPolling interval in seconds5

BGM-Specific Parameters

ParameterDescriptionDefault
--textBGM description (required), can include genre/mood/scene/instruments in the text-
--versionModel versionv5.0
--rewriteEnable automatic prompt rewriteoff
--segmentsStructured segments JSON (v5.0 only)-

Song-Specific Parameters

ParameterDescriptionDefault
--promptPrompt (choose one of --lyrics or --prompt)-
--lyricsLyrics text (supports structural tags)-
--lyrics-fileRead lyrics from file-
--model-versionv4.0 / v4.3 / v5.0v4.3
--genrePrimary genre (e.g. Pop / Folk / Electronic)-
--genre-extraSecondary genres, comma-separated (v4.3)-
--moodMood (e.g. Happy / Dreamy/Ethereal)-
--genderVocal gender Male / Female-
--timbreTimbre (e.g. Warm / Husky / Ethereal)-
--langLanguage (Chinese/English/Cantonese etc.)Chinese
--keyKey (A/A#/B/C etc., v4.3)-
--kmodeMode Major / Minor (v4.3)-
--tempoTempo (Grave/Andante/Allegro etc., v4.3)-
--instrumentInstruments, comma-separated, up to 5 (v4.3)-
--sceneScenes, comma-separated, up to 3 (v4.3)-
--skip-copy-checkDisable lyrics copyright checkoff

For more enum values, see references/params.md.


Notes

  • Short simple music (30s + minimal description) is likely to trigger copyright checks; it is recommended to enrich the description, add more parameters, or increase the duration
  • Audio download links are time-limited; the script automatically downloads the file locally after generation
  • BGM v5.0 does not require separate Genre/Mood parameters; describe them directly in the Text field
  • Vocal songs v4.0 and v4.3 differ in the supported enum values for each field; see the parameter documentation for details

Related skills

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván559 installs18 stars

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai22 installs8 stars

Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.

by fly0pants4.3k installs296 stars

Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.

by Iván855 installs69 stars

More from fackee

Browse all skills

使用 Qwen 3.5 Plus 模型分析视频内容,支持本地文件和远程 URL,可自定义分析提示词和抽帧频率

by www46 installs1 stars

Image generation and editing based on Google Gemini native image generation (Nano Banana).

by fackee1 installs

Generate videos using the Volcengine Doubao Seedance 2.0 model series.

by fackee3 installs