Catalog
fairoosansar-coder/music-generation

fairoosansar-coder

music-generation

Generate ambient background music using Lyria via the Interactions API.

v1.0LATEST
NewUpdated Oct 29, 2026

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

Argument Default Description
--workspace workspace Root workspace directory
--mood default Music mood (see moods below)

Moods

Mood Style Pair with --style
tech (default) Clean synths, electronic pulse, Silicon Valley startup vibe explainer, debate
chill Soft pads, gentle piano, lo-fi warmth roundtable, explainer
debate Building tension, brass-like synths, panel discussion opener debate, 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.

Files1
1 files · 4.4 KB

Select a file to preview

Overall Score

82/100

Grade

B

Good

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

82

Quality

85

Clarity

84

Completeness

78

Summary

This skill generates ~30-second ambient background music for a radio show using Google's Lyria model via the Interactions API. It accepts a mood parameter (tech, chill, debate) that determines the music prompt, calls the Lyria API, decodes the returned audio, and saves it as an MP3 file to a workspace directory. If generation fails, it retries with a simpler fallback prompt and gracefully continues without music if both attempts fail.

Detected Capabilities

API request (Google Lyria via Interactions API)File write (MP3 audio to workspace)Directory creation (workspace/audio/music)Environment variable read (GEMINI_API_KEY)Base64 decoding of audio dataError handling and retry logicCommand-line argument parsing

Trigger Keywords

Phrases that agents use to match this skill to user intent.

generate background musicmusic generation lyriaambient audio productionradio show musicmood-based musicaudio background track

Risk Signals

INFO

Environment variable access for API key (GEMINI_API_KEY)

scripts/generate_music.py:line 75
WARNING

Fallback to 'dummy-key' if GEMINI_API_KEY not set

scripts/generate_music.py:line 75
INFO

Outbound API request to Google Lyria service

scripts/generate_music.py:lines 88-94

Referenced Domains

External domains referenced in skill content, detected by static analysis.

www.apache.org

Use Cases

  • Generate tech-focused electronic background music for technology discussion shows
  • Create ambient chill background music for calm conversation segments
  • Produce dramatic tension-building music for debate or panel discussion segments
  • Generate mood-appropriate background music for radio show production pipelines
  • Add background audio to multi-part radio show content with different segment moods

Quality Notes

  • Skill is well-documented with clear mood definitions and use cases
  • Script includes proper error handling with fallback retry logic
  • Output path is well-defined and predictable within workspace
  • Documentation clearly states graceful degradation (pipeline continues without music)
  • Script includes helpful print statements for user feedback
  • Arguments are properly constrained with choices validation
  • Apache 2.0 license header present and correct
  • API parameter 'store=False' prevents unnecessary data retention
  • Edge case handled: explicit check for both item.type and mime_type to detect audio content
Model: claude-haiku-4-5-20251001Analyzed: Oct 29, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Use fairoosansar-coder/music-generation in your dev environment

Command Palette

Search for a command to run...