NOTE: Although it is possible to Import a 24bpp True Colour BMP as Unsigned 8-bit PCM across 3-channels, separating each of the image data's R, G, and B values into their own Audacity channel, the Export process will insist on mixing the file down to Stereo (2-channels). It may be possible to use a different file format to overcome this limitation, or to individually Export each channel and Recompose the R, G, and B Layers in GIMP.
Image to Audio:
Interpret raw image data as audio. Each pixel will become one audio sample. Apply an audio effect to the image, and see what happens!
- save image to raw format, 8 or 24 bpp
- Audacity: File - Import - Raw
- Encoding: Unsigned 8-bit PCM
- Byte Order: No or Big or raw value?
- Channels: 1 (8bpp) or 3 (24bpp)
- Start Offset: 0 or raw header size
- Amount: 100%
- Sample Rate: Choose! or raw_x = one line per second
- Each audio sample/frame should be one pixel (2.1)
- Effects!
- File - Export - Export Audio
- Other Uncompressed File
- Header: RAW (header-less)
- Encoding: Unsigned 8-bit
- Cut header from BMP and insert at start of data file
- Rename file
- See the effects!
Audio to Image:
Interpret an audio stream as 8 bits per pixel (8bpp, 256 colour). The width X will be decided by you and the height Y will ve determined by that number and the length of the audio.
- Audacity: Mix as Mono (8bpp)
- Set the Audio Position display to show samples (not seconds, frames)
- Resample to rate = Desired image width:
- Square = sqrt(# of samples)
- Use a factoring calculator with # of samples
- Truncate or generate audio as needed to match desired image
- audio length = image X*Y
- sample rate determines lines per second
- IDEA: key of music will affect the waves
- File - Export - Export Audio
- Other Uncompressed File
- Header: RAW (header-less) *** THIS MIXES DOWN TO STEREO! ***
- Encoding: Unsigned 8-bit
- GIMP: Export As new raw or BMP with 8bpp (Mono) or 24bpp (3-channel)
- Cut header from BMP and insert at start of audio data file
- Rename file, open in GIMP
- See the audio!
NOTE: Windows BMP uses a Signed INT for width and height values. Negative height means that the image data is stored with the bottom line first (bottom-to-top, Cartesian) while a positive value means the opposite (top-to-bottom, normal). It is possible to reverse this by inverting the image vertically and changing the sign on the value, or using a different format.