Skip to main content

A Python utility that converts images to audio.

Project description

image2sound

image2sound is a utility that accepts an image file, converts the RGB values of each pixel to a frequency, and saves the result to three separate WAV files.

NOTE: Large image files no longer automatically result in large audio files as the user can specify a target track length and sane defaults are applied when this is not specified.

Requirements

  • PIL
  • numpy
  • wavio
  • argparse
  • math

To run

Simply running python3 main.py will generate audio using the test image and default settings.

Arguments

The following optional arguments may be set, however:

  • -p for a path to an image
  • -key for musical key (defaults to C )
  • -t for tempo (defaults to 60 bpm)
  • -min for the desired number of minutes (defaults to 1 so must be set to zero if shorter tracks are wanted)
  • -sec for the desired number of seconds (defaults to zero)

"Split" mode

Note that the default behavior of the utility is to create a single stereo audio file. Adding --split will split the resulting audio into three separate files (red, green, blue).

"Reveal" mode

Adding --reveal will override the key, tempo, and minutes/seconds with data derived from the image itself, "revealing" the music within the image as it were,

Example 1:

python3 main.py -p image.png -key Dminor -t 80 -min 11 -sec 38

Example 2:

python3 main.py -p image.png -key Dminor -t 80 -min 11 -sec 38 --split

Example 3:

python3 main.py -p image.png --reveal

Project details


Release history Release notifications | RSS feed

This version

0.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image2sound-0.5.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

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

image2sound-0.5-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file image2sound-0.5.tar.gz.

File metadata

  • Download URL: image2sound-0.5.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for image2sound-0.5.tar.gz
Algorithm Hash digest
SHA256 5b43b3116ccf7959d8b1e177ee739f5e4fc19755fb8ea0ec057a6e572925a9e3
MD5 c097cde88013c8937907ff11a32abb54
BLAKE2b-256 3700613b9bb596e2fed5078728cdcdfd2d261c07e3ca5b5c923d364dc7c69a14

See more details on using hashes here.

File details

Details for the file image2sound-0.5-py3-none-any.whl.

File metadata

  • Download URL: image2sound-0.5-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for image2sound-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cca6c01accd9c148dc5b25a8cb59199bcb145b7854835422fea1ae25d48cfd79
MD5 2776a9d83f2c62c8bb32b893d638dc4c
BLAKE2b-256 98c0d4edfa463b53e6dee0f31969c5946ae688f90966fcc1de60bb113fb2bb86

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