music-generation

Generate ambient background music using Lyria via the Interactions API.

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.

More skills from google-gemini

greeter
google-gemini
A friendly greeter skill
official
code-reviewer
google-gemini
Automated code review for local changes and remote pull requests with structured analysis across correctness, maintainability, and security. Supports both local file system changes (staged and unstaged) and remote PRs (by number or URL) with automatic GitHub CLI checkout Analyzes code across seven dimensions: correctness, maintainability, readability, efficiency, security, edge case handling, and test coverage Runs optional preflight verification suites (e.g., npm run preflight ) to catch...
official
review-duplication
google-gemini
Use this skill during code reviews to proactively investigate the codebase for duplicated functionality, reinvented wheels, or failure to reuse existing…
official
reconciliation
google-gemini
Reconcile loaded expenses against the pre-parsed invoice database, flagging discrepancies like amount mismatches, missing invoices, and merchant mismatches…
official
gemini-api-cli
google-gemini
Guide for using the Gemini API CLI tool. Use when you need to interact with the Gemini API via the command line, manage agents, or generate media (images,…
official
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…
official
async-pr-review
google-gemini
Trigger this skill when the user wants to start an asynchronous PR review, run background checks on a PR, or check the status of a previously started async PR…
official
behavioral-evals
google-gemini
Guidance for creating, running, fixing, and promoting behavioral evaluations. Use when verifying agent decision logic, debugging failures, debugging prompt…
official