Skip to main content

Turn images into short musical pieces via algorithmic sonification.

Project description

image2sound

Turn images into short musical pieces via algorithmic sonification.

Installation

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]

PyPI Installation

# With web UI
pip install image2sound[ui]
# or command line only
pip install image2sound

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/drums
  • ambient: Slower, major scale, soft pad/lead/bass instruments
  • cinematic: Faster tempo, orchestral pad/lead/bass
  • rock: 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

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

image2sound_newrealm-0.5.0.tar.gz (44.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

image2sound_newrealm-0.5.0-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

Details for the file image2sound_newrealm-0.5.0.tar.gz.

File metadata

  • Download URL: image2sound_newrealm-0.5.0.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for image2sound_newrealm-0.5.0.tar.gz
Algorithm Hash digest
SHA256 fdb8f363a1943e2832287f6cac0b9336eca4b013576df141c77c45a9602b72c8
MD5 b3c522a1c3a4f75f0feb2a923c0812d2
BLAKE2b-256 54a8fb87ea171e9be78b39076a4a1bb93d360e3d7fbc8041aac185a232fc387e

See more details on using hashes here.

File details

Details for the file image2sound_newrealm-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for image2sound_newrealm-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 341d441e55c20a5c9270c942ea3669def5a2bd90ade6856d790d83a8d0d4c687
MD5 3195feb886ef47b9e3959d09781554e7
BLAKE2b-256 486d157ba8b15c861d76da4739a70d9eece845152cf07a3a2286cd2e613caa59

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page