Music Generation with Google Lyria 3

VerifiedCaution

Generate 30-second music clips or full 2-3 minute songs using Google Lyria 3 via the Gemini API. Free, control genre, BPM, instruments, mood via text prompts.

Sby Skills Guide Bot
ContentIntermediate
7/24/2026
Claude Code
#music-generation#google-lyria#gemini-api#audio#creativity

Recommended for

Automated summary

Generates music using Google Lyria 3 via the Gemini API for free. It can produce 30-second clips or full 2-3 minute songs from text prompts with control over genre, BPM, instruments, and mood.

Strengths

  • Free to use with a Gemini API key
  • Fine-grained control over genre, tempo, instruments, and mood
  • Outputs studio-quality MP3 files
  • Two separate models for clips and full-length songs

Limitations

  • Requires setup (API key and SDK installation)
  • Rate limits on the free tier
  • Full-length song quality can be inconsistent
When to use it

When you need to quickly generate original music for personal projects, prototypes, or creative content without musical composition skills.

When not to use it

For professional music production requiring granular control over each track or advanced mixing.

Security analysis

Caution
Quality score82/100

The skill uses bash to run a Python script with the user prompt stored in an environment variable via `PROMPT='$ARGUMENTS'`. If the prompt contains a single quote, it breaks out of the string and can inject shell commands. The note suggests escaping or using Write tool, but does not enforce safety. Since the user controls the input, risk is low if used carefully, but the vulnerability exists.

Findings
  • •Potential command injection via unsanitized single quotes in prompt when passed to PROMPT environment variable in shell, allowing arbitrary command execution if input contains single quote and command substitution.
How this analysis is made

Examples

Lo-fi hip hop clip
Generate a 30-second lo-fi hip hop clip at 85 BPM with a Rhodes piano, soft vinyl crackle, and simple kick-snare drums, instrumental only, chill and nostalgic mood.
Synthwave song
Create a 2-minute synthwave song at 120 BPM in D minor with analog synthesizers, arpeggiated bass, and a retro drum machine. Energetic and neon-lit vibe, no vocals.
Acoustic folk song
Write a 3-minute acoustic folk song in G major with acoustic guitar, light percussion, and soft male vocals. Melancholic and introspective, with a verse-chorus structure.

name: make-music description: Generate music using Google Lyria 3 (FREE with Gemini API key). 30-second clips or full 2-3 minute songs from text prompts. Genre, BPM, instruments, mood - all controlled via prompt. argument-hint: <prompt describing the music you want> allowed-tools: Bash, Read, Write

Music Generation with Google Lyria 3 (FREE)

Generate 30-second music clips or full 2-3 minute songs using Google's Lyria 3 model via the Gemini API. Free tier — no cost.

Setup

  1. Get a free Gemini API key from Google AI Studio
  2. Set it as an environment variable:
    export GEMINI_API_KEY="your-key-here"
    
  3. Install the Google GenAI SDK:
    pip install google-genai
    

API Details

  • Model (clips): lyria-3-clip-preview — 30-second clips
  • Model (full songs): lyria-3-pro-preview — 2-3 minute complete songs
  • Output: MP3, 48kHz stereo, SynthID watermarked
  • Cost: FREE on Gemini free tier (rate limits apply)

Prompt Tips

Control everything through the text prompt:

  • Genre: "lo-fi hip hop", "synthwave", "jazz", "EDM", "acoustic folk"
  • BPM: "85 BPM", "120 BPM", "140 BPM"
  • Key: "C minor", "G major", "D minor pentatonic"
  • Instruments: "Rhodes piano", "TR-808 drums", "acoustic guitar", "analog synths"
  • Mood: "chill", "energetic", "melancholic", "triumphant", "dreamy"
  • Structure: [Intro], [Verse], [Chorus], [Bridge], [Outro]
  • Vocals: say "instrumental only" or "no vocals" to skip vocals
  • Timestamps: [0:00 - 0:10] Soft piano intro [0:10 - 0:25] Drums kick in

Usage

Run this inline Python script to generate music. The prompt is passed via the PROMPT env var and the Python body is a single-quoted heredoc — so the user's text can't break out of the Python string or inject code.

PROMPT='$ARGUMENTS' python3 - <<'PYEOF'
import os, time
from google import genai
from google.genai import types

key = os.environ.get('GEMINI_API_KEY')
if not key:
    print('ERROR: Set GEMINI_API_KEY environment variable first')
    print('Get a free key at: https://aistudio.google.com/apikey')
    exit(1)

client = genai.Client(api_key=key)
prompt = os.environ.get('PROMPT', '')
out_dir = os.path.join(os.path.expanduser('~'), '.claude-music-gen')
os.makedirs(out_dir, exist_ok=True)

response = client.models.generate_content(
    model='lyria-3-clip-preview',
    contents=prompt,
    config=types.GenerateContentConfig(response_modalities=['AUDIO', 'TEXT']),
)

ts = int(time.time())
for part in response.candidates[0].content.parts:
    if part.text:
        print(f'INFO: {part.text[:200]}')
    if part.inline_data:
        out = os.path.join(out_dir, f'music_{ts}.mp3')
        with open(out, 'wb') as f:
            f.write(part.inline_data.data)
        print(f'MUSIC: {out} ({len(part.inline_data.data) / 1024:.0f} KB)')
PYEOF

Full-Length Songs

For full 2-3 minute songs with verses/choruses, change the model to lyria-3-pro-preview:

PROMPT='$ARGUMENTS' python3 - <<'PYEOF'
import os, time
from google import genai
from google.genai import types

key = os.environ.get('GEMINI_API_KEY')
if not key:
    print('ERROR: Set GEMINI_API_KEY environment variable first')
    exit(1)

client = genai.Client(api_key=key)
prompt = os.environ.get('PROMPT', '')
out_dir = os.path.join(os.path.expanduser('~'), '.claude-music-gen')
os.makedirs(out_dir, exist_ok=True)

response = client.models.generate_content(
    model='lyria-3-pro-preview',
    contents=prompt,
    config=types.GenerateContentConfig(response_modalities=['AUDIO', 'TEXT']),
)

ts = int(time.time())
for part in response.candidates[0].content.parts:
    if part.text:
        print(f'INFO: {part.text[:200]}')
    if part.inline_data:
        out = os.path.join(out_dir, f'song_{ts}.mp3')
        with open(out, 'wb') as f:
            f.write(part.inline_data.data)
        print(f'SONG: {out} ({len(part.inline_data.data) / 1024:.0f} KB)')
PYEOF

Note: If your prompt contains a single quote ('), quote-escape it or use the Write tool to drop the prompt into a temp file first, then read that file in Python. The single-quoted heredoc protects the Python body but can't protect the outer PROMPT='...' assignment.

Rate Limits

  • Free tier has rate limits (be reasonable — add 30s between calls if generating multiple)
  • Clip model: always 30 seconds
  • Pro model: 2-3 minutes, full songs

Limitations

  • Non-deterministic (same prompt = different output each time)
  • Safety filters block copyrighted content or specific artist voice requests
  • Single-turn only (can't iteratively edit a track)

Requirements

  • Python 3.10+
  • google-genai SDK (pip install google-genai)
  • Free Gemini API key from Google AI Studio

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/music-generation-with-google-lyria-3-mrx3xwv1/download' --output '.skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1/SKILL.md.part' && mv '.skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1/SKILL.md.part' '.skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash, Read, Write

Original excerpt: Setup
  1. Get a free Gemini API key from Google AI Studio
  2. Set it as an environment variable:
    export GEMINI_API_KEY="your-key-here"
    
  3. Install the Google GenAI SDK:
    pip install google-genai
    

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1/SKILL.md' && test -s '.skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/make-music' && cp -R '.skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1' '.claude/skills/make-music'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1'

openskills read 'music-generation-with-google-lyria-3-mrx3xwv1'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/music-generation-with-google-lyria-3-mrx3xwv1/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills