music-generation

作者: google-gemini

使用 Interactions API 透過 Lyria 生成環境背景音樂。

npx skills add https://github.com/google-gemini/gemini-managed-agents-templates --skill music-generation

Music Generation

Generate background music for the radio show using the Lyria model via the Interactions API.

Embedded Script

python3 skills/music-generation/scripts/generate_music.py --workspace ./workspace --mood tech

Arguments

ArgumentDefaultDescription
--workspaceworkspaceRoot workspace directory
--mooddefaultMusic mood (see moods below)

Moods

MoodStylePair with --style
tech (default)Clean synths, electronic pulse, Silicon Valley startup vibeexplainer, debate
chillSoft pads, gentle piano, lo-fi warmthroundtable, explainer
debateBuilding tension, brass-like synths, panel discussion openerdebate, interview

What it does

  1. Selects the music prompt based on --mood.
  2. Calls the Interactions API with the lyria-3-clip-preview model.
  3. Generates a ~30-second music clip.
  4. Saves as MP3 to {workspace}/audio/music/background.mp3.
  5. Gracefully handles failures — the pipeline continues without music.

Dependencies

  • google-genai (>= 2.0.0)

Output

  • File: {workspace}/audio/music/background.mp3
  • Format: MP3
  • Duration: ~30 seconds

Fallback

Lyria is experimental. If generation fails with a policy error or returns no music, the script will attempt to retry once with a simpler fallback prompt: "Create a 30-second simple ambient background track. Instrumental only, calm and neutral."

If the fallback attempt also fails, the pipeline proceeds without background music — the audio-mixing step handles this gracefully.

來自 google-gemini 的更多技能

agent-tui
google-gemini
Main Agents: Do NOT use this skill directly. If you need to test the TUI, invoke the `tui_tester` subagent. Drive terminal UI (TUI) applications…
gemini-api-cli
google-gemini
使用 Gemini API CLI 工具的指南。當你需要透過命令列與 Gemini API 互動、管理代理或生成媒體(圖片、……)時使用。
behavioral-evals
google-gemini
建立、執行、修正及推廣行為評估的指引。用於驗證代理決策邏輯、除錯失敗、除錯提示…
gemini-live-api-dev
google-gemini
通過WebSocket與Gemini進行即時雙向串流,支援音訊、視訊和文字對話。支援音訊輸入/輸出(16 kHz PCM)、視訊幀、文字,以及具備語音活動偵測的自動轉錄功能,可處理中斷情況。包含原生音訊功能:情感對話、主動音訊和思考模式;支援同步和非同步工具使用的函式呼叫;以及Google Search基礎驗證。提供具備上下文壓縮、恢復功能的會話管理,以及...
gemini-omni-flash-api
google-gemini
使用此技能進行生成式影片編輯、文字轉影片、圖片參考影片生成,以及基於…的首幀轉場動畫。
gemini-api-dev
google-gemini
We need to translate the given text from English to Traditional Chinese. The text describes building applications with Google's Gemini models, mentioning multimodal content, function calling, structured outputs, supported languages, model versions, features, and SDKs. We must preserve the name "gemini-api-dev" but it's not in the text, so ignore. Also preserve technical terms like "Gemini", "Pro", "Flash", "Pro Image", "1M token context", "Gemini 2.x", "1.5", "JSON", "SDKs", "google-genai", etc. No extra commentary. Output only the translation. Translation: 使用 Google 的 Gemini 模型建置應用程式,支援多模態內容、函式呼叫與結構化輸出,涵蓋 Python、JavaScript、Go 及 Java。可存取最新的 Gemini 3 模型(Pro、Flash、Pro Image),具備 100 萬 Token 上下文;舊版 Gemini 2.x 與 1.5 模型已棄用。支援文字生成、圖片/音訊
gemini-interactions-api
google-gemini
Gemini模型與代理的統一介面,具備伺服器端狀態、串流與工具編排功能。支援多種當前模型(gemini-3-flash-preview、gemini-3-pro-preview、gemini-2.5-flash/pro)及Deep Research代理;自動將已棄用的模型ID替換為當前替代方案。透過previous_interaction_id將對話歷史卸載至伺服器,實現有狀態的多輪互動,無需手動管理歷史記錄。內建工具編排功能,包括...
deliver
google-gemini
將簡報的精簡版本發布到 Google Chat 或 Slack 的 incoming webhook,讓每日執行自動送達——若未設定 webhook 則靜默跳過…