img2wave is a desktop utility that modulates the amplitude of an existing audio file using the top and bottom boundaries of an image.
Thanks to kyrup for instigating the question for how to turn images to waveforms, and to Japhy Riddle's YouTube video for the concept and overall idea. (づ_ど)
- Base Audio & Output Path: Work with common audio files like
.mp3,.ogg, and.wavfiles. Customize your output directory and filename. - Segment Timing: Choose exactly when (in seconds) the image modulation starts and ends within your audio track.
- Resolution Manually define the processing width and height of the image analysis (larger dimensions provide finer boundary details).
- Interpolate: Toggle between smooth linear interpolation and blocky nearest-neighbor interpolation.
- Invert Colors: Instantly swap dark and light spaces to process light shapes on dark backgrounds.
- Threshold: Use the slider or text input (0–255) to quickly dial in the binarization threshold.
- Grayscale Methods: Choose from Luma 601, Luma 709, Average, or Lightness algorithms to handle color-to-grayscale conversion.
- Export Settings:
- Export Full Song: Toggle between exporting the entire base audio track (with the modulated portion mixed in) or just the isolated modulated segment.
- Normalize Output: Force-normalize the output wave's peak amplitude to exactly 0 dBFS.
- Image Preview: A real-time visual panel displaying a binarized, filled-in representation of how your current settings affect the image envelope.
- Go to the Releases tab on the right side of this GitHub repository.
- Download
img2wave-v1.1.0-windows-x64.exe. - Run the executable.
- Select Base Audio: Select your base audio track.
- Select Output Path: Select the directory where the output will be saved.
- Select Image Source: Select the image you want to extract contours from.
- Set Segment Timing: Input the start time and end time (in seconds) where you want the visual shape to modulate the audio.
- Generate: Click Generate Audio.
Important
The processing engine tracks black pixels to define the boundaries of the shape and discards white pixels as empty space. If your source image features a white shape/text on a dark background, make sure the Invert Colors checkbox is checked.
Below is an example of how the text silhouette 'domino' is modulated on an audio track.
| Source Image | Base Audio | Output |
|---|---|---|
'domino' text |
The original track's waveforms |
The word 'domino' visible on waveforms |
You can download and listen to how the shape of the text squeezes and shapes the volume of the track:
If you prefer to bypass the graphical interface and run the tool directly from your terminal, you can interact with main.py.
Make sure you have Python 3.10+ installed. Install the dependencies:
pip install PySide6 pillow numpy soundfileRun the script by providing the required audio and image inputs:
python main.py --audio "my_audio.wav" --image "my_image.png" --start 2.0 --end 5.0--audio <path>(Required): Path to the base audio file.--image <path>(Required): Path to the image file.--output <path>(Default:output.wav): Path to save the generated WAV file.--start <float>(Default:2.0): Segment start time in seconds.--end <float>(Default:5.0): Segment end time in seconds.--threshold <int>(Default:128): Binarization threshold value (0–255).--grayscale <method>(Default:luminance_601): Grayscale algorithm choice:luminance_601,luminance_709,average, orlightness.--invert: Flag to invert image colors.--width <int>(Default:2048): Analysis resolution width.--height <int>(Default:512): Analysis resolution height.--smooth / --no-smooth(Default:--smooth): Use linear interpolation or blocky, step-based interpolation.--normalize: Flag to normalize output peak levels to 0 dBFS.--export-full / --no-export-full(Default:--export-full): Export the full song length or only the modulated segment.--debug: Flag to export debug binarized and filled-in PNG images of the analysis process.




