Skip to content

API Reference parrot_tools.google.lyria_models

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.google.lyria_models

View source

Data models and NLP parameter parsing for Google Lyria music generation.

Class LyriaMusicParameters

Parameters for a Lyria music generation request.

Fields:

Field Type Default Description
prompt str Descriptive text prompt for the music style, instruments, and composition.
duration_seconds int 10 Duration of music in seconds (1 to 120, default 10).
genre Optional[str] None Music genre (e.g., 'Ambient', 'Chillout', 'Lo-Fi Hip Hop', 'Classical').
mood Optional[str] None Mood description (e.g., 'Ambient', 'Chill', 'Dreamy', 'Ethereal Ambience').
bpm int 90 Tempo in beats per minute (60-200, default 90). Slow=60-80, Medium=90-110, Fast=120-160.
temperature float 1.0 Creativity/randomness parameter (0.0 to 3.0, default 1.0).
density float 0.5 Note density (0.0 to 1.0). Sparse/soft=0.2-0.4, Dense/complex=0.7-0.9.
brightness float 0.5 Tonal brightness (0.0 to 1.0). Warm/dark=0.2-0.4, Bright/sharp=0.7-0.9.
negative_prompt Optional[str] None Musical elements or instruments to exclude (e.g. 'drums, vocals').
seed Optional[int] None Deterministic integer seed for reproducible generation.

Method LyriaMusicParameters.validate_prompt

Ensure the prompt is non-empty after stripping whitespace.

validate_prompt(v: str) -> str

Parameter Type Default Description
v str Raw prompt value.

Returns: str — The stripped, validated prompt string.

Raises:

  • ValueError — If the prompt is empty or whitespace-only.

Class LyriaMusicResult

Result object returned after music generation.

Fields:

Field Type Default Description
status Literal['success', 'error'] 'success'
file_path str Absolute path to the output WAV file on disk.
duration_seconds float Length of audio file in seconds.
sample_rate int 48000 Audio sample rate in Hz.
channels int 2 Number of audio channels (2 = stereo).
format str 'wav' Audio container format.
size_bytes int File size in bytes.
parameters LyriaMusicParameters Resolved parameters.
error_message Optional[str] None Error details if failed.

Function parse_natural_music_request

Parse a natural language description into structured LyriaMusicParameters.

Extracts duration, tempo (BPM), note density, tonal brightness, genre, and mood hints from free-form text using keyword and regex heuristics.

parse_natural_music_request(text: str, default_duration: int = 10) -> LyriaMusicParameters

Parameter Type Default Description
text str Free-form natural language music request (e.g. "a soft ambient music with slow tempo").
default_duration int 10 Duration in seconds to use when the text does not mention an explicit duration.

Returns: LyriaMusicParameters — A validated :class:LyriaMusicParameters instance.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally