An AI-powered pipeline for (eventually) creating atmospheric videos by combining AI-generated images, upscaling them, adding subtle animations, and AI-generated music. The pipeline uses ComfyUI for all AI generation tasks and orchestrates the entire workflow through a modular Python architecture.
So far, the project does the following...
- Image Generation: Creates initial atmospheric images using models via ComfyUI
- Image Expansion: Expands the generated images to 1080p images
- Image Upscaling: Upscales images using ESRGAN models to 4k and 8k
And eventually it will...
- Animation: Add subtle animation to the generated images to create short but loop'able videos
- Music Generation: Create multiple long-form ambient music tracks that blend together
- Video Composition: Bring the video and audio together to create multi-hour ambient music videos for platforms like YouTube
- MacOS with Apple Silicon: There is no chance this works on anything else
- Python: 3.9+ (tested on 3.11.10)
- ComfyUI: Locally running instance accessible via HTTP API
- AI Models: Available via services like HuggingFace or Civitai
- pyenv: For Python version management
- Core: pydantic>=2.0.0
- HTTP/WebSocket: websocket-client>=1.6.0, requests>=2.31.0
- Development: autopep8, pylint
Install pyenv if you haven't already:
# macOS (using Homebrew)
brew install pyenv
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc# Clone the repository
git clone https://github.com/leewinder/ambient-track-generation.git
cd ambient-track-generation
# Run the automated setup script
./install.shThe setup script will:
- Install Python 3.11.10 via pyenv
- Create virtual environments for each module
- Install all required dependencies
- Set up the project structure
Update configuration.json with your ComfyUI server details:
{
"comfyui": {
"server": "http://your-comfyui-server:8188/",
"check_interval": 10,
"output": "~/Documents/ComfyUI/output/"
}
}Create authentication.json in the project root with your Suno credentials:
{
"suno": {
"session": "your-__session-cookie",
"client_uat": "your-__client_uat-cookie",
"client": "your-__client-cookie"
}
}Getting Cookies from Browser:
- Go to suno.com and log in
- Open DevTools (F12) → Network tab
- Find any request to
clerk.suno.comorstudio-api.prod.suno.com - Copy the cookie values:
__session(long JWT string)__client_uat(timestamp number)__client(JWT string)
- Paste into
authentication.json
Note: Cookies refresh automatically during generation, but if you see authentication errors, grab fresh cookies from the browser.
# Run all pipeline steps
bash generate.shThe configuration.json file controls the entire pipeline:
- Generation Settings: Seeds, debug mode
- ComfyUI Connection: Server URL, output paths
- Workflow Definitions: AI model parameters and prompts, with workflow overrides
- Pipeline Steps: Execution order and dependencies for each part of the pipeline
ambient-track-generation/
├── configuration.json # Main configuration file
├── install.sh # Automated setup script
├── .python-version # Python version specification
├── src/
│ ├── modules/ # Pipeline execution modules
│ │ ├── content_generation/ # ComfyUI workflow execution
│ │ └── generation_runner/ # Pipeline orchestration
│ └── utilities/ # Shared utilities library
│ └── src/pipeline_utilities/
├── workflows/ # ComfyUI workflow definitions (exported via Export (API))
└── utilities/ # Additional utility scripts
Each module has its own virtual environment for isolation:
src/modules/content_generation/venv/src/modules/generation_runner/venv/
- Create a new directory in
src/modules/ - Add
requirements.txtandmain.py - Run
./install.sh --module <module_name>to set up the environment
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.
- Follow the established code style (PEP8)
- Use type hints consistently
- Document functions and classes clearly
- Test changes thoroughly before submitting