Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Focus Mode Ambience Generator(FMAG) - Generate AI ambient audio loops for deep work from the command line

License

Notifications You must be signed in to change notification settings

JustInCache/fmag-cli

Repository files navigation

๐ŸŽง FMAG CLI - Focus Mode Ambience Generator

 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— 
 โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• 
 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ•—
 โ–ˆโ–ˆโ•”โ•โ•โ• โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘
 โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ•šโ•โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•
 โ•šโ•โ• โ•šโ•โ• โ•šโ•โ•โ•šโ•โ• โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• 

AI-powered ambient soundscapes for deep focus

Python 3.9+ License: MIT Code style: black


๐ŸŒŸ The Story

We've all been there. You sit down to focus, but the silence is deafeningโ€”or worse, your environment is full of distractions. FMAG was born from a simple idea: what if you could generate the perfect ambient soundscape for any focus session, on demand?

FMAG combines the power of AI audio generation with carefully crafted mood presets to create loop-friendly ambient audio that helps you enter (and stay in) flow state. Whether you need the gentle patter of rain on a coffee shop window or the low hum of a spaceship drifting through the cosmos, FMAG has you covered.


โœจ Features

  • ๐ŸŽจ 5 Curated Mood Presets - Carefully designed ambient soundscapes
  • ๐Ÿค– Multiple AI Providers - Support for AudioGen, Bark, and more
  • ๐Ÿ”„ Loop-Optimized Audio - Seamless fade-in, fade-out, and crossfade
  • โฑ๏ธ Flexible Duration - Generate 1-5 minute ambient loops
  • ๐ŸŽ›๏ธ Audio Processing - Automatic volume normalization
  • ๐Ÿ–ฅ๏ธ Beautiful CLI - Rich terminal interface with colors and progress
  • ๐ŸŽฎ Interactive Mode - Guided generation for beginners

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.9 or higher
  • FFmpeg (for audio processing)

Install FFmpeg

# macOS
brew install ffmpeg
# Ubuntu/Debian
sudo apt install ffmpeg
# Windows (with Chocolatey)
choco install ffmpeg

Install FMAG

# From PyPI (when published)
pip install fmag-cli
# From source
git clone https://github.com/fmag-cli/fmag-cli.git
cd fmag-cli
pip install -e .

๐Ÿš€ Quick Start

Interactive Mode

Just run fmag without arguments for a guided experience:

fmag
โ”Œโ”€ ๐ŸŽง FMAG Interactive โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Welcome to Interactive Mode! โ”‚
โ”‚ โ”‚
โ”‚ Let's create the perfect ambient soundscape โ”‚
โ”‚ for your focus session. โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Step 1: Select a mood
 1. ๐ŸŒง๏ธ calm_rain_office
 Gentle rain falling outside a cozy office window
 2. ๐ŸŒฒ forest_cafe
 A peaceful cafe nestled in a forest clearing
 3. ๐Ÿš€ deep_focus_spaceship
 The quiet hum of a spacecraft drifting through deep space
 4. ๐ŸŒŠ ocean_meditation
 Waves gently lapping on a secluded beach at sunset
 5. ๐ŸŒ™ night_coding_lofi
 Late night coding session with lofi beats and city ambience
 6. ๐ŸŽต Custom prompt
Select mood [1]: 

Command Line

# Generate with a preset mood
fmag generate forest_cafe
# Specify duration (in minutes)
fmag generate night_coding_lofi --duration 3
# Use a specific provider
fmag generate ocean_meditation --provider bark
# Custom prompt
fmag generate "peaceful zen garden with wind chimes and bamboo water fountain" -d 5
# Full options
fmag generate calm_rain_office \
 --duration 3 \
 --provider audiogen \
 --output ./my-ambience \
 --debug

๐ŸŽจ Mood Presets

Mood Description Vibe
๐ŸŒง๏ธ calm_rain_office Gentle rain on a cozy office window Calm, focused
๐ŸŒฒ forest_cafe A cafe nestled in a forest clearing Natural, warm
๐Ÿš€ deep_focus_spaceship Spacecraft drifting through deep space Hypnotic, minimal
๐ŸŒŠ ocean_meditation Waves on a secluded beach at sunset Rhythmic, peaceful
๐ŸŒ™ night_coding_lofi Late night coding with lofi beats Chill, nostalgic

View all presets:

fmag moods

๐Ÿ”Œ Providers

FMAG supports multiple AI audio generation backends:

Provider Description Setup
audiogen OpenAI-compatible audio generation Set OPENAI_API_KEY
bark Open-source text-to-audio model pip install bark

View provider status:

fmag providers

Provider Configuration

# AudioGen (OpenAI)
export OPENAI_API_KEY="your-api-key"
# Then generate
fmag generate forest_cafe --provider audiogen

๐Ÿ“ธ CLI Screenshots

Main Banner

 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— 
 โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• 
 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ•—
 โ–ˆโ–ˆโ•”โ•โ•โ• โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘
 โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ•šโ•โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•
 โ•šโ•โ• โ•šโ•โ• โ•šโ•โ•โ•šโ•โ• โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• 
Focus Mode Ambience Generator v1.0.0
AI-powered soundscapes for deep focus

Generation Output

โ”Œโ”€ ๐ŸŽต Selected Mood โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐ŸŒฒ forest_cafe โ”‚
โ”‚ โ”‚
โ”‚ A peaceful cafe nestled in a forest clearing โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Duration: 3.0 minutes
Provider: audiogen
Output: ./output/
โ ‹ ๐ŸŒฒ Generating audio with audiogen...
โ”Œโ”€ ๐ŸŽ‰ Complete โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โœ“ Audio generated successfully! โ”‚
โ”‚ โ”‚
โ”‚ Saved to: ./output/fmag-forest_cafe-20241125.mp3โ”‚
โ”‚ โ”‚
โ”‚ Play with: โ”‚
โ”‚ afplay ./output/fmag-forest_cafe-20241125.mp3 โ”‚
โ”‚ mpv --loop ./output/fmag-forest_cafe-20241125 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ Architecture

System Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ FMAG CLI โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ CLI โ”‚โ”€โ”€โ”€โ–ถโ”‚ Core โ”‚โ”€โ”€โ”€โ–ถโ”‚ Providers โ”‚ โ”‚
โ”‚ โ”‚ (Typer) โ”‚ โ”‚Generator โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ AudioGen โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚
โ”‚ โ–ผ โ–ผ โ”‚ โ”‚ Bark โ”‚ โ”‚ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚
โ”‚ โ”‚ Presets โ”‚ โ”‚ Audio โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ Library โ”‚ โ”‚ Utils โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ โ–ผ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ FFmpeg โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Generation Pipeline

graph LR
 A[Mood Selection] --> B[Prompt Generation]
 B --> C[AI Audio Generation]
 C --> D[Volume Normalization]
 D --> E[Fade In/Out]
 E --> F[Loop Optimization]
 F --> G[MP3 Export]
Loading

Directory Structure

fmag-cli/
โ”œโ”€โ”€ src/
โ”‚ โ””โ”€โ”€ fmag/
โ”‚ โ”œโ”€โ”€ __init__.py # Package exports
โ”‚ โ”œโ”€โ”€ cli.py # Typer CLI interface
โ”‚ โ”œโ”€โ”€ core.py # Generation orchestrator
โ”‚ โ”œโ”€โ”€ audio_utils.py # FFmpeg audio processing
โ”‚ โ”œโ”€โ”€ presets.py # Mood preset definitions
โ”‚ โ””โ”€โ”€ providers/
โ”‚ โ”œโ”€โ”€ __init__.py # Provider registry
โ”‚ โ”œโ”€โ”€ base.py # Abstract provider interface
โ”‚ โ”œโ”€โ”€ audiogen_provider.py
โ”‚ โ””โ”€โ”€ bark_provider.py
โ”œโ”€โ”€ tests/
โ”‚ โ”œโ”€โ”€ test_cli.py
โ”‚ โ””โ”€โ”€ test_core.py
โ”œโ”€โ”€ demo_outputs/
โ”‚ โ””โ”€โ”€ sample_output_commentary.md
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ example_commands.md

๐Ÿงช Development

Setup

# Clone the repository
git clone https://github.com/fmag-cli/fmag-cli.git
cd fmag-cli
# Create virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install in development mode
pip install -e ".[dev]"

Testing

# Run all tests
pytest
# Run with coverage
pytest --cov=fmag --cov-report=term-missing
# Run specific test file
pytest tests/test_core.py -v

Code Quality

# Format code
black src tests
# Lint
ruff check src tests
# Type checking (optional)
mypy src

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Contribution Ideas

  • ๐ŸŽจ Add new mood presets
  • ๐Ÿ”Œ Implement new audio providers
  • ๐ŸŒ Add internationalization
  • ๐Ÿ“ฑ Create a GUI wrapper
  • ๐ŸŽต Improve audio synthesis algorithms

๐Ÿ“ Example Output

Generated files are saved to ./output/ by default:

output/
โ”œโ”€โ”€ fmag-forest_cafe-20241125_143022.mp3
โ”œโ”€โ”€ fmag-night_coding_lofi-20241125_144530.mp3
โ””โ”€โ”€ fmag-ocean_meditation-20241125_150015.mp3

Each file is:

  • 192kbps MP3 format
  • Loop-optimized with crossfade
  • Volume normalized to -16 LUFS
  • Fade in/out (0.5 seconds each)

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

  • Typer - CLI framework
  • Rich - Beautiful terminal formatting
  • FFmpeg - Audio processing
  • Pydub - Audio manipulation

Made with โค๏ธ for focus enthusiasts everywhere

Report Bug ยท Request Feature

About

Focus Mode Ambience Generator(FMAG) - Generate AI ambient audio loops for deep work from the command line

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle ใซใ‚ˆใฃใฆๅค‰ๆ›ใ•ใ‚ŒใŸใƒšใƒผใ‚ธ (->ใ‚ชใƒชใ‚ธใƒŠใƒซ) /