15 interface and application programming

One of the most important part of my final project is to do a tool to map the personal Synaesthesia, generating what that I call the “SYNAESTHETIC UNIT” composed from two things:
1: ” NUMBER or LETTER or WORD”, that can be a SIGN or a SOUND
2: ” COLOR “, that is the personal color associated to the element 1, and that changes for each person.

This “SYNAESTHETIC UNIT” is the input;
The output is a light that takes the color mapped.

For this assignment I generated the codes and he interface to do it, unsing the Arduino IDE and Processing.

The board that I used is based on the “satshakit by Daniele Ingrassia” , and a RGB led anode.

MAPPING: SIGN+COLOR; WRITING; ARDUINO IDE

I used at first the Arduino IDE to generate the first codes to map the colors of Synaesthesia; the codes are very simple:

Here, the input is a “sign” (something that you write) and the output is a led that takes the color of these “sign”.

You can associate a color with a “sign” mapping your synaesthesia; the map here is “manual”: writing the RGB values that corresponds to your colors; in this case without any interface.

the codes that I made:

numbers

colors of numbers

  1. /*
  2. Daniela Frogheri
  3. 12.05.2015
  4. FAB ACADEMY 2015
  5. -------------------------------------------------------------------------
  6. THE COLORS OF THE NUMBERS;
  7. -------------------------------------------------------------------------
  8. VISUALIZATION OF PERSONAL SYNAESTHESIA MAPPING THE COLOR OF THE NUMBERS,LETTERS AND WORDS
  9. map the colors of your numbers writing the RGB
  10. the led ( COMMON ANODE )takes the color of your number
  11.  
  12. -------------------------------------------------------------------------
  13. MyNsynesthesia = to map your color
  14. -------------------------------------------------------------------------
  15.  
  16. */
  17.  
  18. // definition of the pin for each led//
  19. int ledVERDE = 9;
  20. int ledBLU= 10;
  21. int ledROSSO = 11;
  22.  
  23. int MyNsynestesia = 3;// WRITE HERE THE NUMBER
  24. ;
  25.  
  26. void setup()
  27. {
  28. pinMode(ledROSSO,OUTPUT); //red led output;
  29. pinMode(ledVERDE,OUTPUT); //green led output
  30. pinMode(ledBLU,OUTPUT); //blu led output
  31. }
  32.  
  33.  
  34. //LOOP: change the delay to modify the time of the loop;
  35.  
  36. void loop()
  37. {
  38.  
  39. MyNsynestesia = MyNsynestesia;
  40.  
  41. /* THE COLORS OF THE NUMBERS
  42. _______________________________________________________________
  43. -map of the personal colors; this is an example with my colors
  44.  
  45. */
  46.  
  47. if (MyNsynestesia == 0)
  48. {
  49. color(255,255,255);
  50. delay(1000);
  51.  
  52. }
  53.  
  54.  
  55. if (MyNsynestesia == 1)
  56. {
  57. color(50,80,100);
  58. delay(1000);
  59.  
  60. }
  61.  
  62. if (MyNsynestesia == 2)
  63. {
  64. color(40,255,0);
  65. delay(1000);
  66.  
  67. }
  68.  
  69. if (MyNsynestesia == 3)
  70. {
  71. color(255,0,0);
  72. delay(1000);
  73.  
  74. }
  75.  
  76. if (MyNsynestesia == 4)
  77. {
  78. color(200,0,255);
  79. delay(1000);
  80.  
  81. }
  82.  
  83. if (MyNsynestesia == 5)
  84. {
  85. color(255,50,0);
  86. delay(1000);
  87.  
  88. }
  89.  
  90. if (MyNsynestesia == 6)
  91. {
  92. color(0,255,100);
  93. delay(1000);
  94.  
  95. }
  96.  
  97. if (MyNsynestesia == 7)
  98. {
  99. color(0,255,20);
  100. delay(1000);
  101.  
  102. }
  103.  
  104. if (MyNsynestesia == 8)
  105. {
  106. color(220,0,120);
  107. delay(1000);
  108.  
  109. }
  110.  
  111. if (MyNsynestesia == 9)
  112. {
  113. color(0,0,60);
  114. delay(1000);
  115.  
  116. }
  117. }
  118.  
  119. //-----------------------------------------------------------------------
  120. //color function
  121. //-----------------------------------------------------------------------
  122.  
  123. void color(int rosso, int verde, int blu){
  124.  
  125. analogWrite(ledROSSO, 255-rosso);// PWM red; PWM rosso; PWM rojo;
  126.  
  127. analogWrite(ledVERDE, 255-verde);// PWM green; PWM verde; PWM verde;
  128.  
  129. analogWrite(ledBLU, 255-blu);// PWM bu; PWM blu; PWM azul;
  130. }
  131.  
  132. /* NOTES:
  133. - here to map the colors of numbers you have to put each value by hand and searching the RGB;
  134. the next step is to do an interface to select the color and to save the data;
  135. */

alphabet

colors of the alphabet

 

COLORS OF LETTERS

  1. /*
  2. Daniela Frogheri
  3. 12.05.2015
  4. FAB ACADEMY 2015
  5. -------------------------------------------------------------------------
  6. THE COLORS OF THE LETTERS;
  7. -------------------------------------------------------------------------
  8. VISUALIZATION OF PERSONAL SYNAESTHESIA MAPPING THE COLOR OF THE LETTERS
  9. map the colors writing the RGB
  10. the led ( COMMON ANODE )takes the color of your letter
  11. -------------------------------------------------------------------------
  12. MyNsynesthesia = to map your color
  13. -------------------------------------------------------------------------
  14.  
  15. */
  16. // definition of the pin for each led//
  17. int ledVERDE = 9;
  18. int ledBLU= 10;
  19. int ledROSSO = 11;
  1. char MyLsynestesia = 'a';// WRITE HERE THE LETTER;
  2. ;
  1. void setup()
  2. {
  3. pinMode(ledROSSO,OUTPUT); //red led output;
  4. pinMode(ledVERDE,OUTPUT); //green led output
  5. pinMode(ledBLU,OUTPUT); //blu led output
  6. }
  1. //————————————
  2. //LOOP: change the delay to modify the time of the loop;
  3. //————————————
  4. void loop()
  5. {
  1. MyLsynestesia = MyLsynestesia;
  1. /* THE COLORS OF THE LETTERS
  2. _________________________________________________________________________
  3. -map of the personal colors;
  4.  
  1. */
  1. if (MyLsynestesia == 'a')
  2. {
  3. color(0,255,0);
  4. delay(1000);
  1. }
  1. if (MyLsynestesia == 'b')
  2. {
  3. color(0,255,0);
  4. delay(1000);
  1. }
  1. if (MyLsynestesia == 'c')
  2. {
  3. color(255,255,0);
  4. delay(1000);
  1. }
  1. }
  1. /* complete your alphabet ...;
  1. }
  2. if (MyLsynestesia == '')
  3. {
  4. color(255,255,0);
  5. delay(1000);
  6. }
  1. */
  1. /*
  2. -------------------------------------------------------------------------
  3. color function;
  4. -------------------------------------------------------------------------
  5. */
  1. void color(int rosso, int verde, int blu){
  1. analogWrite(ledROSSO, 255-rosso);// PWM red;
  1. analogWrite(ledVERDE, 255-verde);// PWM green;
  1. analogWrite(ledBLU, 255-blu);// PWM blu;
  2. }

 */

 

words

This work is based on my own Synaesthesia :each LETTER of the alphabet has a COLOR; the WORDS take the COLOR of their FIRST LETTER, but rather than static, this color changes becoming white or desaturated; this is what happen in general, but there are some exceptions: some specific letters has two colors, and sometime the words that start with a vibration between those two letters, and then changes to the white like the others.

On this code, I used a string to define a letter or a word with the some parameter: changing the length of the string I can have a letter or a word;

I mapped all the letters of the alphabet

GENERAL CASE

This is when the letter of the alphabet has only one color

– if the string has only 1 element, the color is static: the value of the RGB are numbers;

– if the string length is more than 1, the word takes the color of the first letter and changes to the white; the values of the RGB are parameters;

the delay of the change is directly proportional with the length and with differents possibilities of speed;

for this, I have those parameters:

-durata = general permanence of the light

-pd = to start the delay ( this is not necessary … but is useful for me … can be eliminated)

-x = steps of the change of color and the function is:(x= x+t/length of the word)

-t1, t2, t3, t4 = to control the speed (‘t’ – can be only 1 but is useful for me to combine the colors mixing different speeds)

EXCEPTION

For the case where the letter has two colors

– if is only a letter, the RGB changes from a color to another, in a short time; the values of the RGB are numbers and parameters;

– if is a word, after I putted two loops, the first one like the case of the letter and then it changes slowly to the white, like the option 2 for the general case, using the same parameters; RGB values are parameters.

changing color

change of colors

  1. /*
  2. DANIELA FROGHERI
  3. 20.05.2015
  4. FAB ACADEMY 2015
  5. ---------------------------------------------------------------------------
  6. VISUALIZATION OF PERSONAL SYNAESTHESIA MAPPING THE COLOR OF THE LETTERS AND WORDS;
  7. ---------------------------------------------------------------------------
  8. MAP AND GENERATE YOUR COLORS AND ITS VARIATIONS;
  9. ---------------------------------------------------------------------------
  10. the led ( COMMON ANODE ) takes the color of your letters or words;
  11.  
  12. */
  13.  
  14. // definition of the pin for each led//
  15. int ledVERDE = 9;
  16. int ledBLU= 10;
  17. int ledROSSO = 11;
  18.  
  19. int a = 255; //
  20.  
  21. int c1 = 0; // increasing
  22. int c2 = 0; // increasing
  23. int c3 = 0; // increasing
  24.  
  25. int d1 = 255; // decreasing
  26. int d2 = 255; // decreasing
  27. int d3 = 255; // decreasing
  28.  
  29. int n1 = 10; // steps - slow
  30. int n2 = 20; // steps - med
  31. int n3 = 50; // steps - fast
  32.  
  33.  
  34. String parola = "a"; // can be a letter or a word
  35.  
  36.  
  37.  
  38. void setup()
  39. {
  40. pinMode(ledROSSO,OUTPUT); //red led output;
  41. pinMode(ledVERDE,OUTPUT); //green led output
  42. pinMode(ledBLU,OUTPUT); //blu led output
  43. }
  44.  
  45.  
  46. void loop()
  47. {
  48. parola = parola;
  49.  
  50. a = a;
  51. n1 = n1;
  52. n2 = n2;
  53. n3 = n3;
  54. c1 = c1 + n1; // da 0 a 255 - slow
  55. c2 = c2 + n2; // da 0 a 255 - med
  56. c3 = c3 + n3; // da 0 a 255 - fast
  57. d1 = d1 - n1; // da 255 a 0 - slow
  58. d3 = d3 - n3; // da 255 a 0 - fast
  59.  
  60.  
  61. // generate your color
  62.  
  63. if (parola [0]== 'a')
  64. {
  65. color(d1,c1,d2); // the combination between the parameters with differents speed, can generate the change of colors that you want;
  66. delay (1000);
  67. }
  68. }
  69.  
  70. // color function
  71.  
  72. void color(int rosso, int verde, int blu){
  73.  
  74.  
  75. analogWrite(ledROSSO, 255-rosso);// PWM red;
  76.  
  77. analogWrite(ledVERDE, 255-verde);// PWM green;
  78.  
  79. analogWrite(ledBLU, 255-blu);// PWM bu; PWM blu;
  80. }
  81.  
  82.  
  83.  
  84.  

 

colors of alphabet and words

colors of words-alfa

  1. /*
  2. DANIELA FROGHERI
  3. 30.05.2015
  4. FAB ACADEMY 2015
  5. ---------------------------------------------------------------------------------------------
  6. COLORS OF ALPHABET AND WORDS
  7. ---------------------------------------------------------------------------------------------
  1. VISUALIZATION OF PERSONAL SYNAESTHESIA MAPPING THE COLOR OF THE LETTERS AND WORDS
  2. map the colors writing the RGB
  3. the led ( COMMON ANODE )takes the color of your letter
  1. ----------------------------------------------------------------------------------------------
  2. **********************************************************************************************
  3. READ THE COMPLETE DESCRIPTION IN THE BOTTOM OF THE PAGE
  4. **********************************************************************************************
  1. */
  1. // definition of the pin for each led//
  2. int ledVERDE = 9;
  3. int ledBLU= 10;
  4. int ledROSSO = 11;
  1. int x = 0; // steps for the change from the color to the white; directly proportional to the length of the word
  2. int durata; // during of the ligth (delay);
  3. int pd = 500; // initial value of the delay;
  4. int t1 = 50; // fast
  5. int t2 = 10; // middle
  6. int t3 = 1; // slow
  7. float t4 = 0.1; //very slow
  1. String parola = "alphabet"; // can be a letter or a word
  1. void setup()
  2. {
  3. pinMode(ledROSSO,OUTPUT); //red led output;
  4. pinMode(ledVERDE,OUTPUT); //green led output
  5. pinMode(ledBLU,OUTPUT); //blu led output
  6. }
  1. void loop()
  2. {
  3. parola = parola;
  1. x = x + t2/parola.length();// x + (1/length of the word);
  2. t1 = t1;
  3. t2 = t2;
  4. t3 = t3;
  5. t4 = t4;
  6. pd = pd;
  7. durata = pd ;
  1. // PERSONAL MAPPING: COLORS OF THE LETTERS OF THE ALPHABET
  1. //--------------------------------------------------------
  2. // mappa la a
  3. //--------------------------------------------------------
  4. if (parola [0]== 'a' && parola.length() == 1)
  5. {
  6. color(255,0,0); // scrivi i tuoi valori rgb della a
  7. delay (durata);
  8. }
  9. else if (parola [0]== 'a' && parola.length() > 1)
  10. {
  1. color(255,x,x); // somma x ai valori minori di 255
  2. delay (1000);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la b
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'b' && parola.length() == 1)
  6. {
  7. color(0,255,0); // scrivi i tuoi valori rgb della b
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'b' && parola.length() > 1)
  2. {
  3. color(x,255,x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la c
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'c' && parola.length() == 1)
  6. {
  7. color(255,100,0); // scrivi i tuoi valori rgb della c
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'c' && parola.length() > 1)
  2. {
  3. color(255,100+x,x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la d
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'd' && parola.length() == 1)
  6. {
  7. color(255,10,70); // scrivi i tuoi valori rgb della d
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'd' && parola.length() > 1)
  2. {
  3. color(255,10+x,70+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la e
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'e' && parola.length() == 1)
  6. {
  7. color(0,100,255); // scrivi i tuoi valori rgb della e
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'e' && parola.length() > 1)
  2. {
  3. color(x,100,255); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la f
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'f' && parola.length() == 1)
  6. {
  7. color(255,80,0); // scrivi i tuoi valori rgb della e
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'f' && parola.length() > 1)
  2. {
  3. color(255,80+x,x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la g
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'g' && parola.length() == 1)
  6. {
  7. color(220,0,120); // scrivi i tuoi valori rgb della g
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'g' && parola.length() > 1)
  2. {
  3. color(220+x,x,120+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la h
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'h' && parola.length() == 1)
  5. {
  6. color(100,100,0); // scrivi i tuoi valori rgb della h
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'h' && parola.length() > 1)
  2. {
  3. color(100+x,100+x,x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la i
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'i' && parola.length() == 1)
  5. {
  6. color(220,220,220); // scrivi i tuoi valori rgb della i
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'i' && parola.length() > 1)
  2. {
  3. color(220-x,220-x,220-x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la j
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'j' && parola.length() == 1)
  5. {
  6. color(230,230,50); // scrivi i tuoi valori rgb della j
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'j' && parola.length() > 1)
  2. {
  3. color(230-x,230-x,50-x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la k
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'k' && parola.length() == 1)
  5. {
  6. color(250,170,30); // scrivi i tuoi valori rgb della k
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'k' && parola.length() > 1)
  2. {
  3. color(250-x,170-x,30-x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la l
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'l' && parola.length() == 1)
  5. {
  6. color(110,110,240); // scrivi i tuoi valori rgb della l
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'l' && parola.length() > 1)
  2. {
  3. color(110-x,110-x,240-x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la m
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'm' && parola.length() == 1)
  5. {
  6. color(220,100,0); // scrivi i tuoi valori rgb della m
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'm' && parola.length() > 1)
  2. {
  3. color(220+x,100+x,x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la n
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'n' && parola.length() == 1)
  6. {
  7. color(0,0,255); // scrivi i tuoi valori rgb della n
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'n' && parola.length() > 1)
  2. {
  3. color(x,x,255); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la o
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'o' && parola.length() == 1)
  5. {
  6. color(0,0,100); // scrivi i tuoi valori rgb della o
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'o' && parola.length() > 1)
  2. {
  3. color(x,x,100); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la p
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'p' && parola.length() == 1)
  6. {
  7. color(250,10,120); // scrivi i tuoi valori rgb della p
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'p' && parola.length() > 1)
  2. {
  3. color(250,10+x,120+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la q
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'q' && parola.length() == 1)
  6. {
  7. color(100,20,100); // scrivi i tuoi valori rgb della q
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'q' && parola.length() > 1)
  2. {
  3. color(100+x,20+x,100+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la r
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'r' && parola.length() == 1)
  6. {
  7. color(255,90,10); // scrivi i tuoi valori rgb della r
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'r' && parola.length() > 1)
  2. {
  3. color(255,90+x,10+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la s
  3. //--------------------------------------------------------
  4. else if (parola [0]== 's' && parola.length() == 1)
  5. {
  6. color(0,255,100); // scrivi i tuoi valori rgb della s
  7. delay(durata);
  1. }
  1. else if (parola [0]== 's' && parola.length() > 1)
  2. {
  3. color(x,255,100+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la t
  3. //--------------------------------------------------------
  4. else if (parola [0]== 't' && parola.length() == 1)
  5. {
  6. color(0,255,10); // scrivi i tuoi valori rgb della s
  7. delay(durata);
  1. }
  1. else if (parola [0]== 't' && parola.length() > 1)
  2. {
  3. color(x,255,10+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la u
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'u' && parola.length() == 1)
  5. {
  6. color(0,0,255); // scrivi i tuoi valori rgb della u
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'u' && parola.length() > 1)
  2. {
  3. color(x,x,255); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la v
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'v' && parola.length() == 1)
  5. {
  6. color(0,100,200); // scrivi i tuoi valori rgb della v
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'v' && parola.length() > 1)
  2. {
  3. color(x,100+x,255); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la w
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'w' && parola.length() == 1)
  5. {
  6. color(10,10,200); // scrivi i tuoi valori rgb della w
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'w' && parola.length() > 1)
  2. {
  3. color(10+x,10+x,200+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. //--------------------------------------------------------
  2. // mappa la y
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'y' && parola.length() == 1)
  5. {
  6. color(220,220,50); // scrivi i tuoi valori rgb della y
  7. delay(durata);
  1. }
  1. else if (parola [0]== 'y' && parola.length() > 1)
  2. {
  3. color(220-x,220-x,50-x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  2. //--------------------------------------------------------
  3. // mappa la z
  4. //--------------------------------------------------------
  5. else if (parola [0]== 'z' && parola.length() == 1)
  6. {
  7. color(0,255,80); // scrivi i tuoi valori rgb della z
  8. delay(durata);
  1. }
  1. else if (parola [0]== 'z' && parola.length() > 1)
  2. {
  3. color(x,255,80+x); // somma x a i valori minori di 255
  4. delay(durata);
  1. }
  1. }
  1. /*
  2. ---------------------------------------------------------------------------------------------
  3. color function;
  4. ---------------------------------------------------------------------------------------------
  5. */
  1. void color(int rosso, int verde, int blu){
  1. analogWrite(ledROSSO, 255-rosso);// PWM red;
  1. analogWrite(ledVERDE, 255-verde);// PWM green;
  1. analogWrite(ledBLU, 255-blu);// PWM bu; PWM blu;
  2. }
  1. /*
  1.  

colors af alphabet and numbers_with changing colors

  1. /*
  2. DANIELA FROGHERI
  3. 30.05.2015
  4. FAB ACADEMY 2015
  5. ---------------------------------------------------------------------------------------------
  6. COLORS OF ALPHABET AND WORDS;
  7. ---------------------------------------------------------------------------------------------
  1. VISUALIZATION OF PERSONAL SYNAESTHESIA MAPPING THE COLOR OF THE LETTERS AND WORDS
  2. map the colors writing the RGB
  3. the led ( COMMON ANODE )takes the color of your letter
  1. EXAMPLES
  1. */
  1. // definition of the pin for each led//
  2. int ledVERDE = 9;
  3. int ledBLU= 10;
  4. int ledROSSO = 11;
  1. int x = 0; // steps for the change from the color to the white; directly proportional to the length of the word
  2. int durata; // during of the ligth (delay);
  3. int pd = 500; // initial value of the delay;
  4. int t1 = 50; // fast
  5. int t2 = 10; // middle
  6. int t3 = 1; // slow
  7. float t4 = 0.1; //very slow
  8. int p;// value +
  9. int n;// value -
  1. String parola = "kaaa"; // can be a letter or a word
  1. void setup()
  2. {
  3. pinMode(ledROSSO,OUTPUT); //red led output;
  4. pinMode(ledVERDE,OUTPUT); //green led output
  5. pinMode(ledBLU,OUTPUT); //blu led output
  6. }
  1. void loop()
  2. {
  3. parola = parola;
  1. x = x + t2/parola.length();// x + (1/length of the word);
  2. t1 = t1;
  3. t2 = t2;
  4. t3 = t3;
  5. t4 = t4;
  6. pd = pd;
  7. durata = pd;
  8. n = n+1;
  9. p = 255-1;
  1. // PERSONAL MAPPING: COLORS OF THE LETTERS OF THE ALPHABET
  1. //--------------------------------------------------------
  2. // GENERAL: the letter has only a static color; the word changes from the color to the white
  3. //--------------------------------------------------------
  4. if (parola [0]== 'a' && parola.length() == 1)
  5. {
  6. color(255,0,0); // the values of the color are numbers
  7. delay (durata);
  8. }
  9. else if (parola [0]== 'a' && parola.length() > 1)
  10. {
  1. color(255,x,x); // the colors runs to the (255, 255, 255)
  2. delay (1000);
  1. }
  1. //--------------------------------------------------------
  2. // EXCEPTION : the letter has two colors thar are alternated; the word changes from the color to the white
  3. //--------------------------------------------------------
  4. else if (parola [0]== 'k' && parola.length() == 1)
  5. {
  6. color(255,n,n); // two alternated colors
  7. delay(20);
  8. }
  1. else if (parola [0]== 'k' && parola.length() > 1)
  2. {
  1. color(255,n,0); // two alternated colors
  2. delay(20);
  3. color(255,x,x); // the colors runs to the (255, 255, 255)
  4. delay(durata);
  1. }
  1. }
  1. /*
  2. ---------------------------------------------------------------------------------------------
  3. color function;
  4. ---------------------------------------------------------------------------------------------
  5. */
  1. void color(int rosso, int verde, int blu){
  1. analogWrite(ledROSSO, 255-rosso);// PWM red;
  1. analogWrite(ledVERDE, 255-verde);// PWM green;
  1. analogWrite(ledBLU, 255-blu);// PWM bu; PWM blu;
  2. }

MAPPING AND SELECTING: SIGN +COLORS; INTERFACES; PROCESSING AND ARDUINO IDE

I used Processing to generate an interface to associate a color with a number, letter or word, connecting with arduino to send the information to the leds;

For the interface I found a very useful example, that I used to understand how to select a color from a picture and sent it to a led, but I had to change it, because in my case the most important thing was to connect the color with a letter or number; another thing that I changed are the values of the les because it was wrote for a cathode, but I’m using anodes.

reference: selecting colors and ligth

This is the Arduino IDE that I made that works with all the next codes

arduino ide for interface and audio

  1. /*
  2. DANIELA FROGHERI
  3. Fab Academy 2015
  4.  
  5. SELECT A COLOR FROM A PICTURE
  6. ______________________________
  7. with the processing:
  8. DF_TRANSYN_VOICE_02
  9. DF_TRANSYN_select_color02
  10. DF_TRANSYN_select3color02
  11. ______________________________
  12. FOR LED ANODE
  13.  
  14. */
  15.  
  16. int Red = 11;
  17. int Green = 10;
  18. int Blue = 9;
  19. int r ;
  20. int g ;
  21. int b ;
  22. void setup()
  23. {
  24. Serial.begin(9600);
  25. pinMode(Red,OUTPUT);
  26. pinMode(Green,OUTPUT);
  27. pinMode(Blue,OUTPUT);
  28. }
  29. void loop()
  30. {
  31. if(Serial.available()==9) // each data has 9 elements
  32. {
  33. r=(Serial.read()-48)*100 ;// first data for r
  34. r=r+(Serial.read()-48)*10;// 2 data for r
  35. r=r+(Serial.read()-48);// 3 data for r
  36.  
  37. g=(Serial.read()-48)*100 ;
  38. g=g+(Serial.read()-48)*10;
  39. g=g+(Serial.read()-48);
  40.  
  41. b=(Serial.read()-48)*100 ;
  42. b=b+(Serial.read()-48)*10;
  43. b=b+(Serial.read()-48);
  44.  
  45.  
  46.  
  47.  
  48.  
  49. int empty = Serial.read();
  50. }
  51. analogWrite(Red,255-r);
  52. analogWrite(Green,255-g);
  53. analogWrite(Blue,255-b);
  54. }

The concept here is how to map the colors of your synaesthesia, to generate the “synaesthetic unit”; in this case rather than search the values of the RGB colors, you can select directly the colors in your pc, from a image that can be a RGB palette, or any other image … a draw … a photo; this case is more immediate than the other and easier to use from anyone

reference: colors values

the codes that I made:

Select a color from a picture and send it to an anode RGB

  1. /*
  2. DANIELA FROGHERI
  3. Fab Academy 2015
  4.  
  5. SELECT A COLOR FROM A PICTURE
  6. ______________________________
  7. with the arduino: DF_TRANSYN_CON INTERFACE_color02
  8.  
  9.  
  10. */
  11.  
  12.  
  13.  
  14. import processing.serial.*;
  15. //atributos
  16. int R=0;
  17. int G=0;
  18. int B=0;
  19.  
  20. Serial port;
  21. color c=255; // first color
  22.  
  23.  
  24.  
  25. void setup(){
  26. println(Serial.list());
  27. port = new Serial(this, Serial.list()[5], 9600);// [5] is my port; is necessary to select the port tha you are using
  28. size(600,500);//size of the window
  29. background(255,255,255); //
  30. frameRate(1000);
  31. }
  32.  
  33.  
  34. void draw(){
  35.  
  36. //catch a color from an image and put into the circle
  37. PImage azzurra; // the picture has to be saved in the folder of this schetch
  38. azzurra=loadImage("azzurra.jpg");
  39. image(azzurra,150,150);
  40. fill(c);
  41. ellipse (300,90,60,60);//circle to show the color selected
  42.  
  43.  
  44. //action botton
  45. if(mousePressed){
  46.  
  47. //to catch the color from the photo
  48. if(mouseX>150 && mouseX<450 && mouseY>150 && mouseY<450){
  49. c = get(mouseX,mouseY);//to obtain the value
  50.  
  51.  
  52.  
  53. //RGB to send in serial
  54. R = (int)red(c);
  55. G = (int)green(c);
  56. B = (int)blue(c);
  57. println(c); // the thing that prints
  58. }
  59. }
  60. // the string to send to ardiuno by serial
  61. String out = nf(R,3) + nf(G,3) + nf(B,3);// all the colors has 3 elements
  62. println(out); // console
  63. port.write(out); // for the serial port
  64. }

Captura de pantalla 2015-06-20 a las 22.15.50

IMG_6933_2

Select a color from a picture, associate it to a letter and send it to an anode RGB

 

  1. /*
  2. DANIELA FROGHERI
  3. Fab Academy 2015
  1. SELECT AND MAP COLORS FROM A PICTURE */
  1. import processing.serial.*;
  2. //atributos
  3. int R=0;
  4. int G=0;
  5. int B=0;
  6. char parola;
  7. int valore;
  8. int i;
  1. Serial port;
  1. color c1=255;
  2. color c2=255;
  3. color c3=255;
  1. void setup(){
  2. println(Serial.list());
  3. port = new Serial(this, Serial.list()[5], 9600);// [5] is my port; is necessary to select the port tha you are using
  4. size(600,500);
  5. background(255,255,255);
  6. frameRate(1000);
  7. }
  1. void mouseClicked() {
  2. valore = valore+1;
  1. }
  1. void draw(){
  1. //TEXT
  2. fill(192,192,192);
  3. PFont font = loadFont("SansSerif-48.vlw");// save the font
  4. textFont(font,28);
  5. text("a",190,60);
  6. text("b",290,60);
  7. text("c",390,60);
  8. //catch the colors from an image and put into the circles
  9. PImage cerchio2;
  10. cerchio2=loadImage("cerchio2.jpg");
  11. image(cerchio2,150,150);
  1. fill(c1);
  2. stroke (c1);
  3. ellipse (200,100,50,50);
  1. fill(c2);
  2. stroke (c2);
  3. ellipse (300,100,50,50);
  1. fill(c3);
  2. stroke (c3);
  3. ellipse (400,100,50,50);
  1. //action botton
  2. if(mousePressed){
  3. //color from the picture
  4. if(mouseX>150 && mouseX<450 && mouseY>150 && mouseY<450){
  5. if(valore == 0){
  6. c1 = get(mouseX,mouseY);
  1. } else if (valore == 1){
  2. c2 = get(mouseX,mouseY);
  1. }else if (valore == 2){
  2. c3 = get(mouseX,mouseY);
  3. }
  1. if(mousePressed){
  2. if(mouseX>150 && mouseX<200 && mouseY>100 && mouseY<150)
  3. {
  4. c1 = get(mouseX,mouseY);//obtener valor del color}
  1. }
  2. }
  3. }
  1. //RGB to send in serial
  2. if (valore == 0){
  3. R = (int)red(c1);
  4. G = (int)green(c1);
  5. B = (int)blue(c1);
  6. println(c1);
  1. } else if (valore == 1){
  2. R = (int)red(c2);
  3. G = (int)green(c2);
  4. B = (int)blue(c2);
  5. println(c2);
  1. } else if (valore == 2){
  2. R = (int)red(c3);
  3. G = (int)green(c3);
  4. B = (int)blue(c3);
  5. println(c3);
  1. }
  2. // the string to send to ardiuno by serial
  3. String out = nf(R,3) + nf(G,3) + nf(B,3);// all the colors has 3 elements
  4. println(out); // console
  5. port.write(out); // for the serial port
  6. }}
  7.  

Captura de pantalla 2015-06-20 a las 21.52.32

Captura de pantalla 2015-06-20 a las 21.59.11

IMG_6932

MAPPING COLOR; SOUND; PROCESSING AND ARDUINO IDE

The sounds are elements very important in the world of synaesthesia; they can be related with taste, smell, shapes, textures … and colors of course; the sounds can be music, noise, a machine working, animals … but here now the focus is the language, and for this, I decided to use a voice speaking.

At first I though to record some words and associating them with colors; but in this way it would had been a “closed world” able to work only with some specific sounds that you have saved before. I thought that this option will had be too limited.

My idea was to do something more immediate, to show in real time the color of the word that you are telling; another thing very important for me is to do something that doesn’t works not only with pre-established words, but with any word!

I though to record some simple sounds (phonemes) associating colors with each frequence … it was a good idea, but researching about, I discovered that now it was really impossible for me to do it …! Is not a work for one person, and in a short time! I felt ingenuous too … because the world of sounds joined with the language … generating all on real time for any word … is something really complicated!

But in my researches, I found a good new! The think that I was trying to invent … is the speech recognition! Obviously it exist … and I can use it;

The best option that I found is this one:

STT-Processing

https://github.com/getflourish/STT

is very powerful … very precise and can be used for anyone in any language!

The code runs in Processing, and when you talk, it writes the word (or letter, or number) … I modified the code, and “catching” the word that it generates; using all the things that I experimented before mapping the colors, doing the interface and sending to the led with Arduino, and “catching” the word that it generates;

This process was not so easy for me; at first I was trying to send the world to my code in Arduino; but finally the best way was to rewrite it in Processing, using Arduino only for the part that controls the led;

The code, for now is personalized with my own synaesthesia, but can be personalized from anyone.

my code

voice and light

  1. /*
  2. DANIELA FROGHERI
  3. Fab Academy 2015
  1. THE COLOR OF THE VOICE:
  2. voice+text+color
  3. ______________________________
  4. when you talk the led takes the color of your world mapped in according whith your synaesthesia
  1. ______________________________
  2. with the arduino:
  3. DF_TRANSYN_con_interface02
  1. ______________________________
  2. FOR LED ANODE
  1. */
  1. import processing.serial.*;
  1. int R=0;
  2. int G=0;
  3. int B=0;
  4. int x;
  1. // speek recongition: STT library
  1. import com.getflourish.stt.*;
  1. STT stt;
  2. String result;
  3. String key = "xxx"; // put here your API code
  1. // data for the serial
  2. Serial port;
  3. color c1=255;
  1. void setup(){
  2. println(Serial.list());
  3. port = new Serial(this, Serial.list()[5], 9600);// put here your serial port []
  4. size(600,400);//
  5. background(255,255,255);
  6. frameRate(100);
  1. // press a key and talk
  1. stt = new STT(this, key);
  2. stt.enableDebug();
  3. stt.setLanguage("es-MX");
  4. //first text
  1. textFont(createFont("Arial", 60));
  2. result = "TransSynaesthesia";
  3. x=x+20;
  1. }
  1. void draw(){
  1. background(200);
  2. text(result, mouseX, mouseY);// transcription of the word that you tell
  1. // the word takes the color mapped
  2. fill(c1);
  3. stroke (c1);
  1. // TO MAP THE COLORS: it is recognizing the first letter of the word in according with my synaesthesia
  1. if (mousePressed){
  1. if(result.charAt(0) == 'a') // map the a
  2. {
  3. c1 = color(255,0,0);
  4. }
  5. else if(result.charAt(0) == 'b'&& mouseX>100) // map the b
  6. {
  7. c1 = color(0,255,0);
  1. }
  2. else if(result.charAt(0) == 'c') // map the c
  3. {
  4. c1 = color(255,200,0);
  1. }
  2. else if(result.charAt(0) == 'd') // map the d
  3. {
  4. c1 = color(255,0,255);
  1. }
  2. else if(result.charAt(0) == 'e') // map the e
  3. {
  4. c1 = color(0,100,255);
  1. }
  1. else if(result.charAt(0) == 'f') // map the f
  2. {
  3. c1 = color(255,80,0);
  1. }
  2. else
  3. {
  4. c1 = color(255,255,255); // if it is another letter, white
  1. }
  1. //rgb for the serial
  1. R = (int)red(c1);// int to floar
  2. G = (int)green(c1);
  3. B = (int)blue(c1);
  4. println(c1); // write the color
  1. }
  2. // string sending to arduino
  3. String out = nf(R,3) + nf(G,3) + nf(B,3);
  4. println(out);
  5. port.write(out); // serial
  6. }
  1. // from the STT library
  1. // Method is called if transcription was successfull
  2. void transcribe (String utterance, float confidence)
  3. {
  4. println(utterance);
  5. result = utterance;
  6. }
  1. // Use any key to begin and end a record
  2. public void keyPressed () {
  3. stt.begin();
  4. }
  5. public void keyReleased () {
  6. stt.end();
  7. }
  8.  
  9.  

I know that this version of the code is very “primitive” and I have to complete it, … making more fluids some parts … putting the interface to map the color … adding the variation from a color to another … and a lot of other things … but anyway it works! When I tell a word … I can see and show its color with a colorful light!

  1.  
  2. <a href="http://www.fablabmty.org/wp-content/uploads/2015/02/Captura-de-pantalla-2015-06-20-a-las-23.10.13.png"><img class="alignnone size-full wp-image-4188" src="http://www.fablabmty.org/wp-content/uploads/2015/02/Captura-de-pantalla-2015-06-20-a-las-23.10.13.png" alt="Captura de pantalla 2015-06-20 a las 23.10.13" width="1248" height="772" /></a>

 

 

 

 

IMG_6934

IMG_6942_2

IMG_6941

video


mapping synesthesia: preparing the map for colors and number

FullSizeRender


Files:

folder w15