Create lush, generative ambient music with spacey textures
Project description
🎼 Ambient Generator TUI
Create lush, generative ambient music with spacey textures in your terminal.
Screenshots
Example Output
Sample track generated with the Hirajoshi scale (rendered with GeneralUser GS soundfont):
- 🎵 Download MP3 - Listen to the rendered audio
- 📄 Download MIDI - View the raw composition
Features
- 🎼 Multiple scales - Currently featuring Japanese pentatonic scales (Hirajoshi, In Sen, Kumoi, Yo)
- 🎹 Five layered instruments (Pad, Flute, Vibraphone, Strings, Music Box)
- 🎚️ Adjustable tempo and length
- 🎨 Multiple soundfonts (5 high-quality GM soundfonts included)
- 🎛️ Audio effects (Reverb and Paulstretch time-stretching)
- 📦 Export to MIDI, WAV, and MP3
- 💻 Beautiful terminal user interface (TUI)
- ⚡ Simple setup - one dependency (PortAudio), then
pip install!
Installation
Option 1: MIDI Only (No System Dependencies)
Generate MIDI files only, with no audio rendering:
pip install ambient-gen
This installs just the core dependencies and lets you create MIDI files that you can render with your own tools.
Option 2: Full Audio Synthesis (Recommended)
Generate MIDI + WAV + MP3 files with built-in audio rendering:
macOS
# Install PortAudio first
brew install portaudio
# Install ambient-gen with audio support
pip install ambient-gen[audio]
Linux (Ubuntu/Debian)
# Install PortAudio development files
sudo apt-get update
sudo apt-get install portaudio19-dev
# Install ambient-gen with audio support
pip install ambient-gen[audio]
Windows
# No additional dependencies needed on Windows
pip install ambient-gen[audio]
The [audio] extra includes soundfonts and FFmpeg for complete audio rendering!
Quick Start
Launch the interactive TUI:
ambient-gen
The TUI is fully interactive - use keyboard controls to customize generation!
Usage
Interactive Mode
ambient-gen
Keyboard Controls
Generation & Files:
g- Generate new track (creates MIDI, WAV, and MP3)o- Open output folderq- Quit
Scale Selection:
s- Cycle through scales (Hirajoshi → In Sen → Kumoi → Yo)
Parameters:
↑/kor↓/j- Adjust tempo (30-120 BPM)→/lor←/h- Adjust length (4-32 bars)
Instruments:
1- Toggle Pad layer2- Toggle Flute layer3- Toggle Vibraphone layer4- Toggle Strings layer5- Toggle Music Box layer
Audio Options:
a- Toggle audio effects (Reverb + Paulstretch)e- Toggle effects only mode (just reverb/paulstretch, no dry signal)f- Cycle soundfonts (FluidR3 GM, GeneralUser GS, SGM V2.01)p- Toggle Paulstretch time-stretching effect
Visual:
Ctrl+P- Change color palette
Command Line Mode
Generate without the TUI:
The app provides an interactive TUI where you can:
- Adjust tempo, bars, and scale selection
- Toggle individual instrument layers
- Enable/disable audio effects
- Cycle through different soundfonts
- Generate tracks with live preview
Output Files
Generated files are saved to ~/Desktop/ambient_gen_output/:
ambient_YYYYMMDD_HHMMSS.mid- MIDI fileambient_YYYYMMDD_HHMMSS.wav- High-quality WAV audio (44.1kHz, 16-bit)ambient_YYYYMMDD_HHMMSS.mp3- Compressed MP3 audio (192kbps)
How It Works
- Generates MIDI: Creates generative compositions using Japanese pentatonic scales with intelligent note placement and dynamics
- Renders Audio: Uses tinysoundfont to synthesize audio with high-quality GM soundfonts (automatically extracted on first run)
- Applies Effects: Optional reverb and Paulstretch time-stretching for ambient textures
- Converts to MP3: Automatically uses FFmpeg (via static-ffmpeg) to create compressed audio
All of this happens automatically with zero configuration!
Japanese Scales
- Hirajoshi (平調子): Traditional pentatonic scale (0, 2, 3, 7, 8) - Contemplative and meditative
- In Sen (陰旋): Mystical and contemplative (0, 1, 5, 7, 10) - Dark and mysterious
- Kumoi (雲井): Bright and ethereal (0, 2, 3, 7, 9) - Light and floating
- Yo (陽): Simple and peaceful (0, 2, 5, 7, 9) - Major pentatonic, uplifting
Included Soundfonts
The package includes 3 high-quality, freely-licensed General MIDI soundfonts (compressed to 41MB):
- FluidR3 GM (23MB) - Clean, balanced GM soundfont (MIT License)
- GeneralUser GS (7MB) - Excellent pads and flutes, perfect for ambient (Custom Permissive License)
- SGM V2.01 (27MB) - Rich, warm ambient tones (GPLv3)
Soundfonts are automatically extracted from a compressed archive on first import.
See LICENSES.md for complete licensing information and attribution.
Development
Install in Development Mode
git clone https://github.com/yourusername/ambient-gen.git
cd ambient-gen
pip install -e .
Project Structure
ambient_gen/
├── __init__.py # Package init with soundfont extraction
├── __main__.py # Entry point for python -m
├── tui.py # Main TUI application
├── midi_generator.py # MIDI composition engine
├── audio_renderer.py # Audio synthesis and effects
├── soundfont_manager.py # Soundfont discovery and management
└── soundfonts.tar.xz # Compressed soundfonts (41MB)
→ Extracts to soundfonts/ on first import
Technical Details
- Audio Quality: 44.1kHz, 16-bit stereo WAV
- MIDI Resolution: 960 ticks per quarter note
- Effects: Freeverb reverb, Paulstretch time-stretching (4x stretch)
- Package Size: ~41MB (soundfonts compressed with xz)
- Python Version: 3.8+
Credits
- Soundfonts:
- FluidR3 GM - Frank Wen (MIT License)
- GeneralUser GS - S. Christian Collins (Permissive License)
- SGM V2.01 - David Shan (GPLv3)
- Audio Synthesis: tinysoundfont
- FFmpeg Integration: static-ffmpeg
- TUI Framework: Textual
License
MIT License - see LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ambient_gen-1.0.0.tar.gz.
File metadata
- Download URL: ambient_gen-1.0.0.tar.gz
- Upload date:
- Size: 43.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a7ac68da95add720a2bda49e2a438e8825b07504e22135753961019553d322b
|
|
| MD5 |
cc2bb337055d2556a3d2e15513754756
|
|
| BLAKE2b-256 |
d9fc44352e040a0ae26865ea6beb72ff27119afbd810cb57afbcfcf1c36bc31a
|
Provenance
The following attestation bundles were made for ambient_gen-1.0.0.tar.gz:
Publisher:
publish.yml on beowulf-audio/ambient-gen-tui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ambient_gen-1.0.0.tar.gz -
Subject digest:
6a7ac68da95add720a2bda49e2a438e8825b07504e22135753961019553d322b - Sigstore transparency entry: 833307550
- Sigstore integration time:
-
Permalink:
beowulf-audio/ambient-gen-tui@cf6c811ca310f8786f11be51ab292785cb71c8d7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/beowulf-audio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf6c811ca310f8786f11be51ab292785cb71c8d7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ambient_gen-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ambient_gen-1.0.0-py3-none-any.whl
- Upload date:
- Size: 43.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
315907dfebfa081a6e84461fa0db054ee1e7b276409f092b4b12401cf7778209
|
|
| MD5 |
603074e856c4feb0061cc134137f2d52
|
|
| BLAKE2b-256 |
b8ea23782d9a4d9cd9f7f38ef3d3c507b843f47de38c1ca10fc07c0f6168587c
|
Provenance
The following attestation bundles were made for ambient_gen-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on beowulf-audio/ambient-gen-tui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ambient_gen-1.0.0-py3-none-any.whl -
Subject digest:
315907dfebfa081a6e84461fa0db054ee1e7b276409f092b4b12401cf7778209 - Sigstore transparency entry: 833307551
- Sigstore integration time:
-
Permalink:
beowulf-audio/ambient-gen-tui@cf6c811ca310f8786f11be51ab292785cb71c8d7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/beowulf-audio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf6c811ca310f8786f11be51ab292785cb71c8d7 -
Trigger Event:
workflow_dispatch
-
Statement type: