lyria-cli
v0.1.1
Published
Music generation CLI powered by Google's Lyria 3 API
Maintainers
Readme
lyria
Music generation CLI powered by Google's Lyria 3 API. Generate full songs, 30-second clips, or image-to-music -- all from the command line.
Install
npm install -g lyria-cliOr with Bun:
bun add -g lyria-cliSetup
Get an API key from Google AI Studio, then:
lyria keys set gemini AIza...Or set the GEMINI_API_KEY environment variable.
Usage
Generate from a prompt
lyria generate -p "A chill lo-fi hip hop beat with Rhodes piano and vinyl crackle" -o lofi.mp3Quick 30-second clip
lyria generate -m clip -p "Upbeat drum loop, 140 BPM" -o loop.mp3Image-to-music
lyria generate -i sunset.jpg -p "Atmospheric soundtrack for this scene" -o sunset.mp3Song files
Create and edit a YAML song file with structured sections and lyrics:
lyria init my-song.yaml --genre "indie folk"
# Edit my-song.yaml with your lyrics and structure...
lyria song my-song.yamlSong file format:
title: Summer Nights
genre: indie pop
tempo: 120 BPM
key: G major
mood: nostalgic, warm
instruments: acoustic guitar, soft drums, bass
voice: female, alto, breathy
model: pro
sections:
- type: intro
description: Gentle acoustic guitar picking
- type: verse
lyrics: |
Walking down the boardwalk
Salt air in my hair
- type: chorus
lyrics: |
Summer nights, summer lights
Everything feels right
- type: outro
description: Fade out with guitarModels
| Alias | Model | Duration | Cost |
|--------|------------------------|-----------|------------|
| pro | lyria-3-pro-preview | ~2-3 min | $0.08/song |
| clip | lyria-3-clip-preview | 30 sec | $0.04/clip |
Prompting tips
- Genre & era: "Early 90s hip-hop", "K-pop with Motown influence"
- Instruments: "Fender Rhodes piano", "TR-808 drum machine"
- Tempo: "120 BPM" or "slow ballad"
- Key: "G major", "D minor"
- Mood: "Nostalgic and bittersweet", "Energetic and triumphant"
- Vocals: "Male baritone, gravelly and soulful"
- Structure: Use
[Verse 1],[Chorus],[Bridge]tags - Lyrics: Prefix with "Lyrics:" then write your words
See the full prompt guide in the Lyria prompt guide.
Development
git clone https://github.com/zhendalf/lyria.git
cd lyria
bun install
bun test # run tests
bun run typecheck # type check
bun run cli.ts # run from sourceLicense
MIT
