JPEG to WAV Converter
Thursday, January 6, 2005, 07:53 PM
Here's a little program which will convert an image in JPEG form into an audio file.

The idea here is based on the fact that the color for each pixel of a jpeg is represented by a 24 bit number. Much like web colors, each component of a pixel (Red, Green, and Blue) is stored with 8 bits, and has a maximum value of 255 (2^8=256). By using these three 8 bit colors together to create one 24 bit number, we can create a 24 bit audio sample with each pixel. Since we need 44,100 samples for each second of audio, most of the .wav files you'll create will be pretty short, unless you use a particularly large image.

To use this utility, all you have to do is click 'open', select the .jpg file that you would like to convert into a .wav file, and then click the 'process' button The program will then ask you to supply a file name for the .wav file. It will take a little while to process the image, so sit tight...and you'll get a .wav file in a little bit.

Currently there are two different methods that you can use for the conversion:

Type 0 (or nothing): A 24 bit sample is created by multiplying each of the 8 bit RGB components of a pixel together.

Type 1: A 24 bit sample is created by taking each of the 8 bit RGB values, converting them into binary, concatenating them, and then converting them back into decimal. For example, if a pixel has a 'red' value of 250, a 'green' value of 120, and a 'blue' value of 5, I convert these values into 11111010, 01111000, and 00000101 respectively. These are then concatenated to form 111110100111100000000101. This number is then used to create the sample. This method has the benefit that it is reversable (sort of), so you can convert an image into a wav, and then back to an image again...I'm still working on making that part of this thing work better.

This excellent program does something similar: