image2sound
Turn images into short musical pieces via algorithmic sonification.
Installation
PyPI Installation
pip install image2sound-newrealm # core only
pip install 'image2sound-newrealm[ui]' # + Gradio UI
pip install 'image2sound-newrealm[opencv]' # + OpenCV feature extraction
pip install 'image2sound-newrealm[audio]' # + Soundfile output
pip install 'image2sound-newrealm[ml]' # + scikit-learn clustering
pip install 'image2sound-newrealm[full]' # all extras
Development Setup (Current)
# Clone the repository
git clone https://github.com/newrealmco/image2sound.git
cd image2sound
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install with UI support
pip install -e .[ui]
Quickstart
GUI (Recommended)
image2sound-ui
Opens a beautiful web interface in your browser where you can:
- Upload images with drag & drop
- Choose musical styles and settings
- Watch real-time generation progress
- Play generated music instantly
- Download files and open in file manager
Command Line
python -m image2sound.cli examples/demo.jpg -o out.wav --style ambient --duration 20
How it works
- Extract features: Brightness, contrast, edge density, and 5-color palette from image
- Map to music: Hue → key, brightness → BPM/scale, contrast+edges → intensity
- Compose arrangement: 4/4 time with chords, lead melody, bass, and drums
- Synthesize audio: Sine waves with harmonics and ADSR, drums as noise bursts
Styles
neutral: Balanced mapping, piano/lead/drumsambient: Slower, major scale, soft pad/lead/bass instrumentscinematic: Faster tempo, orchestral pad/lead/bassrock: Fastest, minor scale, piano/lead/drums with punch
Examples
# Basic usage
python -m image2sound.cli photo.jpg
# Custom style and duration
python -m image2sound.cli landscape.png --style cinematic --duration 30
# Output to specific file
python -m image2sound.cli portrait.jpg -o music.wav --style rock --duration 15
Batch demo
Generate a comprehensive demo set with musical metadata for analysis:
# Run batch processing on all images in examples/
python scripts/batch_demo.py
# Creates files like: bright_gradient_ambient_C_ionian_95bpm_4-4_I-V-vi-IV.wav
# Outputs CSV with: file,image,style,bpm,key,mode,meter,progression,seed,brightness,contrast,edge_density
The batch script processes all images in examples/ with each of the 4 styles (neutral, ambient, cinematic, rock), creating descriptive filenames that include the musical parameters and outputting detailed CSV metadata for analysis.
Development & Testing
# Install with development dependencies
pip install -e .[ui] -r requirements-dev.txt
# Run tests
pytest -q
# Test CLI
python -m image2sound.cli examples/demo.jpg -o out.wav --style ambient
# Test UI (opens in browser)
image2sound-ui
Metadata
Release files for image2sound-newrealm 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| image2sound_newrealm-0.5.1.tar.gz | 47.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| image2sound_newrealm-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.5 kB
Release files / image2sound_newrealm-0.5.1.tar.gz
| Download URL | image2sound_newrealm-0.5.1.tar.gz |
|---|---|
| Size | 47.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60219b32c9adbc5907f1b23df7ab89d22f60e235c8e6498c3d75cfc26622b804
|
|
BLAKE2b-256 checksum How to use checksums |
3da51d7540a0ee68a267cc4c0f23dabac49be42f4b5c72cf376401343ba1ed11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / image2sound_newrealm-0.5.1-py3-none-any.whl
| Download URL | image2sound_newrealm-0.5.1-py3-none-any.whl |
|---|---|
| Size | 44.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f62ec1393f63f88b09215bee3fa43e17e54348fac2a1e9cdc08abafc2b9462d
|
|
BLAKE2b-256 checksum How to use checksums |
f1e07de1dc43a6dc3fdf83e1d284ecafa5bc76d6f2c34c2ba81715b8d4a883dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|