Monday, November 14, 2011

Computer Synesthesia

Synesthesia (also spelled synæsthesia or synaesthesia, plural synesthesiae or synaesthesiae), from the ancient Greek σύν (syn), "together," and αἴσθησις (aisthēsis), "sensation," is a neurologically based condition in which stimulation of one sensory or cognitive pathway leads to automatic, involuntary experiences in a second sensory or cognitive pathway. People who report such experiences are known as synesthetes. (http://en.wikipedia.org/wiki/Synesthesia)

Here, we are going to illustrate Synesthesia as a situation where a person (in this case the computer) hears images. I.e. instead of seeing them, the pathway goes from the eyes to the part of the brain that understands sounds (or something like that :))

How is it like to hear images? Let's hear one.

You have to have this tools:
A linux distribution
The pacat program (check if you have it, otherwise install it)
A little C (so we need gcc compiler)

Here is the code for reading a file. We are going to use it to read image files:

#include
int main(int argc, char *argv[])
{
int t = 0;
FILE *input;
input = fopen(argv[1], "r");
while (t != -1)
{t = getc(input); putchar(t);}
fclose(input);
}

Save it as sounds.c and compile it using gcc sounds.c -o sounds
Then use
sounds mypicture.png | pacat --format u8 --rate 8000

And you can hear your pictures and images :P Don't expect the sweetest melody :P