npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

harmony-cli

v1.1.0

Published

AI-powered music generation CLI tool using Google's Lyria RealTime for coding background music

Readme

🎵 H## Features

  • 🎼 Real-time Music Generation: Uses Google's Lyria RealTime model for high-quality instrumental music
  • ⏱️ 1-Minute Segments: Perfect length for immersive coding sessions
  • 🔄 Parallel Processing: Generates next segment while current segment plays for seamless experience
  • 🎵 Customizable Parameters: Set BPM, mood, and music themes
  • 🎯 Coding-Focused: Designed specifically for background music while coding
  • 🌈 Beautiful CLI Interface: Colorful and interactive command-line experience
  • No-Gap Playback: Seamless transitions between segments
  • 🧹 Smart Memory Management: Automatic cleanup of old segments alt text

An AI-powered music generation CLI tool that creates personalized instrumental music for coding sessions using Google's Gemini Lyria RealTime model.

Features

  • 🎼 Real-time Music Generation: Uses Google's Lyria RealTime model for high-quality instrumental music
  • 🎛️ Two Generation Modes:
    • Interactive Mode: Generate 15-second segments on demand, perfect for focused work
    • Continuous Mode: Auto-generate 30-second segments for uninterrupted listening
  • 🔄 Parallel Processing: Generates next segment while current segment plays for seamless experience
  • Customizable Parameters: Set BPM, mood, and music themes
  • Coding-Focused: Designed specifically for background music while coding
  • 🌈 Beautiful CLI Interface: Colorful and interactive command-line experience
  • No-Gap Playback: Seamless transitions between segments
  • 🧹 Smart Memory Management: Automatic cleanup of old segments

Installation

  1. Clone or download this project
  2. Install dependencies:
    npm install
  3. Get your Gemini API key:
    • Visit Google AI Studio
    • Create or use an existing API key
    • Make sure you have access to the Lyria RealTime model

Usage

Run the CLI tool:

npx harmony-cli

Or if installed globally:

npm install -g .
harmony-cli

Interactive Setup

The CLI will guide you through:

  1. API Key Input: Enter your Gemini API key
  2. Music Theme: Describe the type of music you want (e.g., "chill lo-fi hip hop", "ambient electronic", "peaceful piano")
  3. Tempo Selection: Choose BPM from predefined options (70-160 BPM)
  4. Mood Selection: Pick from various moods like Chill, Upbeat, Ambient, etc.

How It Works

🔄 Continuous Generation Workflow:

  1. Generate first 1-minute segment
  2. Play current segment + Generate next segment (in parallel)
  3. When both complete, seamlessly move to the new segment
  4. Repeat the cycle automatically

Perfect for coding because:

  • 1-minute segments: Ideal length for immersive musical experience
  • No interruptions: Generation happens while music plays
  • No gaps: Seamless transitions between segments
  • Continuous variety: New AI-generated music every minute

Example Prompts

Music Themes:

  • "minimal techno for deep focus"
  • "jazz fusion with smooth bass"
  • "ambient electronic soundscape"
  • "lo-fi hip hop with vinyl crackle"
  • "classical piano with gentle strings"
  • "synthwave retro vibes"

Available Moods:

  • Chill
  • Upbeat
  • Ambient
  • Energetic
  • Peaceful
  • Dreamy
  • Focused

How It Works

  1. Connection: Establishes connection to Gemini Lyria RealTime via Python bridge
  2. Initial Generation: Creates first 30-second music segment
  3. Parallel Processing: While playing current segment, generates next segment in background
  4. Seamless Playback: Transitions between segments with no gaps
  5. Continuous Loop: Keeps generating and playing until user stops with Ctrl+C
  6. Smart Cleanup: Automatically removes old segments to save disk space

Parallel Generation Flow

🎼 Generate Segment 1 → 🎵 Play Segment 1
                        ↓ (while playing)
                        🎼 Generate Segment 2 → 🎵 Play Segment 2  
                                               ↓ (while playing)
                                               🎼 Generate Segment 3...

Technical Details

  • Audio Format: 16-bit PCM, 48kHz, Stereo
  • API: Google Gemini Lyria RealTime via WebSocket
  • Latency: Low-latency real-time streaming
  • Quality: High-fidelity instrumental music
  • Watermarking: All generated audio includes identification watermarks

Configuration Options

The CLI automatically configures:

  • BPM: 60-200 (user selectable)
  • Temperature: 1.1 (creativity level)
  • Density: 0.7 (musical complexity)
  • Brightness: 0.6-0.8 (tonal quality)
  • Guidance: 4.0 (prompt adherence)
  • Mode: QUALITY (vs DIVERSITY)

Controls

While music is playing:

  • Ctrl+C: Stop music and exit
  • Music streams continuously with real-time generation
  • Adaptive to coding rhythm and flow

Requirements

  • Node.js 16+
  • Valid Gemini API key with Lyria RealTime access
  • Internet connection for real-time streaming

Notes

  • Experimental Model: Lyria RealTime is currently an experimental model
  • Instrumental Only: Generates instrumental music only
  • Watermarked: All output follows Google's Responsible AI principles
  • Real-time: Music generation adapts and continues based on your prompts

Troubleshooting

Connection Issues:

  • Verify your Gemini API key is valid
  • Check internet connection
  • Ensure Lyria RealTime model access

Audio Issues:

  • The CLI simulates audio streaming (actual implementation requires proper WebSocket setup)
  • For real audio playback, additional system audio libraries may be needed

Development

This project demonstrates the structure for integrating with Gemini Lyria RealTime. The actual WebSocket implementation requires:

  1. Proper authentication with Gemini API
  2. WebSocket connection to the Lyria RealTime endpoint
  3. Audio buffer management for smooth playback
  4. Real-time prompt and configuration updates

License

MIT


Happy Coding with AI Music! 🎵