Git Product home page Git Product logo

image2sound's Introduction

image2sound

Encapsulate an image into an audio file.
It uses the image as the spectrogram of the audio and recover the spectral phases through Griffin-Lim algorithm, using librosa package.
Code written by Laurent Benaroya under GNU GPL v3 license.

pipenv installation

$ sudo apt install pipenv 

OR if you don't have root priviledges (see https://pipenv.pypa.io/en/latest/install/) => prerefered!!!

$ pip install --user pipx
$ pip install --upgrade pip
$ pipx install pipenv
$ pip install --user pipenv
$ export PYTHON_BIN_PATH="$(python3 -m site --user-base)/bin"
$ export PATH="$PATH:$PYTHON_BIN_PATH"

You can add the export PATH in your ~/.bashrc
Note : pipenv problem : pypa/pipenv#5052

Create project

$ pipenv --python 3.9
$ pipenv install
$ pipenv shell

You may need to install tkinter with the command sudo apt-get install python3-tk for matplotlib display in compare_image_and_spectrogram.py (not compulsory).

Go for it !!!

audio generation

$ python image2sound.py -h

usage: image2sound.py [-h] --img IMG --wav WAV [--inv] [--custom] generate audio from image taken as the spectrogram, inversion using Griffin-Lim algorithm (see https://librosa.org/doc/latest/generated/librosa.griffinlim.html for references to this algorithm) optional arguments: -h, --help show this help message and exit --img IMG filename of the input image --wav WAV filename of the output audio (wav) --inv swap gray image scale --custom custom settings for GL

$ python image2sound.py --img demo/signature_basique.jpg --wav demo/signature_basique.wav

try the options --inv (usefull when the image is mostly black) and --custom (try it for fun)

play the audio using mplayer or audacity etc !!!

visualization and comparison

visualize the original image and the spectrogram from the output audio :

$ python compare_image_and_spectrogram.py --img demo/signature_basique.jpg --wav demo/signature_basique.wav

illustration

deactivate from pipenv virtual environment

$ exit

image2sound's People

Contributors

laurentbenaroya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.