├── README.md ├── SpoutController.dll ├── SpoutReceiver2.dll ├── SpoutSender2.dll ├── Spyrographics.pde ├── Spyrographics.txt ├── controls.pde ├── deprecated └── Controls old.txt ├── functions.pde ├── midibus.pde ├── osccontrols.pde ├── spirograph.pde └── spout.pde /README.md: -------------------------------------------------------------------------------- 1 | # Spyrographics 2 | 3 | VIDEO : 4 | https://www.youtube.com/watch?v=Puk9GwLdf-g&t=3s 5 | 6 | Video de instalación (como instalarlo): https://www.youtube.com/watch?v=obPg2Rfykkg&t=39s 7 | 8 | 9 | Video de uso (como usarlo): https://www.youtube.com/watch?v=QqH8csJEEi4&t=60s 10 | 11 | 12 | Videos are in spanish for now only. 13 | 14 | 15 | GIFS : 16 | 17 | SPYROGRAPHICS ONLY : 18 | https://media.giphy.com/media/l0HlE1StQMxSopLt6/200.gif#26 19 | https://media.giphy.com/media/3o6ZtoDLw5MFU9Uy9W/200.gif#29 20 | https://media.giphy.com/media/l0HlMiSKaNkZJI8eI/200.gif#34 21 | 22 | SPYROGRAPHICS && RESOLUME : 23 | 24 | https://media.giphy.com/media/l2JhFafVpK9UN5xKM/200.gif#15 25 | https://media.giphy.com/media/l2JhFafVpK9UN5xKM/200.gif#15 26 | https://media.giphy.com/media/3oriO07YHnivWJIdZm/200.gif#23 27 | 28 | Album de imagenes - ALBUM OF IMAGES MADE WITH THIS SOFT : 29 | 30 | https://www.facebook.com/julian.puppo/media_set?set=a.10209248135934727.1073741837.1061460212&type=3 31 | 32 | REFERENCIA EN ESPAÑOL: 33 | 34 | Aplicación basada en el movimiento de un espirografo para la generación de visuales adaptada para que funcione en el resolume. 35 | Caracteristicas : 36 | 37 | *Uso de libreria de MIDI (Esta mapeada para un nanoKontrol2 , para modificarla se debería hacer directo por codigo, o directamente usar el resolume) 38 | 39 | *Uso de OSC utilizando la app ControlOSC (https://play.google.com/store/apps/details?id=com.charlieroberts.Control) 40 | 41 | *Visuales Audioreactivas. 42 | 43 | INSTALACIÓN : 44 | 45 | 1)Instalar Spout. 46 | 2)Instalar SpoutControls 47 | Link : http://spout.zeal.co/download-software/ 48 | 3)Instalar Processing. 49 | 4)Descargar la carpeta con todos los archivos del proyecto y colocarlas dentro de la carpeta de instalación del resolume>plugins>vfx 50 | 5)Abrir el archivo que dice "Spyrographics.pde". 51 | Las primeras 6 lineas de codigo indican que librerias se estan utilizando para el proyecto. 52 | descargar librerías faltantes . Ir Tools>Add Tools > Libraries y buscar : 53 | 54 | * Themidibus. 55 | * oscP5. 56 | * Controlp5. 57 | * Minim. 58 | * Spout. 59 | 60 | Los controles solo funcionan si se esta abierto como ventana del processing, es decir que si estamos trabajando en resolume no va a funcionar. 61 | 62 | CONTROLES 63 | 64 | * v : Cambia el modo de display. 65 | * a : Limpia la pantalla 66 | * B : PrintScreen 67 | 68 | 1) MODO DIBUJAR A MANO. En este modo es solo un patron de dibujos, sin que se mueva. 69 | 70 | M: Modo mouse o no mouse. Dibuja solo cuando apretas el mouse o dibuja siempre. 71 | 72 | 73 | 2) MODO MATRIX : Te genera una matriz visual de objetos perfectamente separada. 74 | 75 | Para controlar las filas y columnas se utilizan las flechas : 76 | 77 | * UP : Agrega fila. 78 | * DOWN : Borra fila. 79 | * LEFT : Agrega columna. 80 | * RIGHT : Borra columna. 81 | 82 | 83 | 3) MODO OBJETOS. ESTE ES EL MODO POR DEFECTO 84 | 85 | * R: Borra todos los dibujos. 86 | * C: Te desactiva el ultimo objeto que apretaste 87 | 88 | Se pueden crear grupos de objetos seteados con variables para luego poder crear otros y tener distintos grupos. 89 | para hacer varias figuras moviendose. 90 | 91 | BARRA ESPACIADORA: Setea un grupo de objetos para que no cambien las variables 92 | (Todos los que se crearon desde que se apreto el mouse hasta que se apreto la barra espaciadora). 93 | 94 | 4) CONTROLosc - MultiButton Demo. 95 | Genera también una matriz de dibujos con la posibilidad de activar y desactivar cada dibujo especifico. 96 | Este modo de display tiene mapeado el layout multibutton demo de la aplicación ControlOSC. 97 | 98 | 5) CONTROLosc - MultiTouchXY. 99 | Te permite manipular cada dibujo utilizando el layout de controlOSC. 100 | 101 | 102 | * t,g : Para aumentar y disminuir el tamaño del dibujo 103 | * y,h : Para aumentar y disminuir la circunferencia de giro 104 | * u,j : Para aumentar el efecto espirografico. 105 | * a : Para limpiar la pantalla 106 | * d : Para activar el modo que se limpia la pantalla constantemente 107 | * q : Para randomizar de 0 el tamaño al ultimo tamaño asignado. 108 | * e : Para activar un random que te rompe la cabeza con el color. 109 | * i,k Para aumentar y disminuir el HUE 110 | * o,l Para aumentar y disminuir la saturacion 111 | * p,ñ Para aumentar y disminuir el brillo. 112 | * b,n : transparencia. 113 | 114 | Colores del borde 115 | * 2,3: Tamaño del borde 116 | * 4,5: Saturación del borde 117 | * 6,7: brillo del borde 118 | * 8,9: transparencia del borde 119 | 120 | COMO RETOCAR VARIABLES MAXIMAS Y MINIMAS PARA EL RESOLUME : 121 | 122 | Abrir el archivo que dice Spyrographics.txt, ahí figura el nombre de cada variable, el valor maximo y el minimo. 123 | 124 | CAMBIOS PARA HACER : 125 | - Remplazar los arrays por arraylists. 126 | - Emprolijar el codigo. 127 | 128 | 129 | REFERENCE IN ENGLISH 130 | 131 | App developed in processing for generating visuales inspired in a spirograph 132 | 133 | Features: 134 | 135 | * MIDI LIBRARY(Esta mapeada para un nanoKontrol2 , para modificarla se debería hacer directo por codigo, o directamente usar el resolume) 136 | 137 | * OSC using ControlOSC (https://play.google.com/store/apps/details?id=com.charlieroberts.Control) 138 | 139 | * Audioreactive drawings 140 | 141 | INSTALLATION : 142 | 143 | 1)Install Spout. 144 | 2)Install SpoutControls 145 | Link : http://spout.zeal.co/download-software/ 146 | 3)Install Processing. 147 | 4)Download the folder with all of the files of the proyect and put them inside plugins>vfx in the resolume installation folder. 148 | 5)Open the file with the name "Spyrographics.pde". 149 | The first 6 lines of code tell´s you what libraries are being used. Download missing libraries : 150 | Go to Tools>Add Tools > Libraries y search for : 151 | 152 | * Themidibus. 153 | * oscP5. 154 | * Controlp5. 155 | * Minim. 156 | * Spout. 157 | 158 | HOW TO CHANGE MIN AND MAX POSIBLES VALUES IN RESOLUME : 159 | open the file with the name "Spyrographics.txt" , there you will find all the variables names, changes max and min values as you wish. 160 | 161 | 162 | CONTROLS 163 | 164 | * v : Change displayMODE 165 | * a : Clears the screen 166 | * B : PrintScreen 167 | 168 | 1) DISPLAY MODE 1 : HANDDRAWING . This mode is for drawing with the mouse. 169 | Press M for activate the "always draw" or "draw only when press" option 170 | 171 | 2) DISPLAY MODE 2 : MATRIX : Makes a object matrix separated of drawings 172 | 173 | To add or remove columns and rows : 174 | *UP : Add row. 175 | *DOWN : Remove Row. 176 | *LEFT : Add column. 177 | *RIGHT : Remove column. 178 | 179 | 180 | 3) MODO FREE OBJECTS. DEFAULT MODE : 181 | 182 | R: Erase all objects 183 | C: Erase last object 184 | 185 | You can set diferent groups of figures using SPACEBAR 186 | 187 | 188 | 4) CONTROLosc - MultiButton Demo. 189 | 190 | Also makes a object matrix with the posibility to activate or desactivate each object specifically. It´s used ControlOSC- multibutton demo Layout to work. 191 | 192 | 5) CONTROLosc - MultiTouchXY. 193 | Make posible to control each object separated using the multiTouchXY layout also from OSC 194 | 195 | 196 | * t,g : size 197 | * y,h : Amplitud 198 | * u,j : Speed of the spirographich effect 199 | * d : Activate always cleaning mode 200 | * q : Randomize size of drawing using SIZE value as the max posible value and 0 as the min posible value 201 | * e : HEADACHE RANDOM COLOR. (IT BURNS YOUR BRAIN) 202 | * i,k : HUE 203 | * o,l :saturacion 204 | * p,ñ : brightness. 205 | * b,n : Alpha channel. 206 | 207 | STROKE : 208 | * 1: HUE 209 | * 2,3: SIZE 210 | * 4,5: SATURATION 211 | * 6,7: brightness 212 | * 8,9: Alpha channel 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /SpoutController.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpupper/Spyrographics/4ca62a6bfaa28ac68411b7bbecb3ae717cf25f87/SpoutController.dll -------------------------------------------------------------------------------- /SpoutReceiver2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpupper/Spyrographics/4ca62a6bfaa28ac68411b7bbecb3ae717cf25f87/SpoutReceiver2.dll -------------------------------------------------------------------------------- /SpoutSender2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpupper/Spyrographics/4ca62a6bfaa28ac68411b7bbecb3ae717cf25f87/SpoutSender2.dll -------------------------------------------------------------------------------- /Spyrographics.pde: -------------------------------------------------------------------------------- 1 | import spout.*; 2 | import themidibus.*; //Librería del controlador midi. 3 | import ddf.minim.*; //Librería de sonido. 4 | import oscP5.*; 5 | import netP5.*; 6 | 7 | /*UESAAAA*/ 8 | 9 | /* Spirographics. 10 | Software de dibujo y visuales que permite definir objetos que se mueven como un espirografo. 11 | Todo lo demas fue creado por Julián Puppo. 2016 */ 12 | 13 | /*Cambios a realizar : 14 | Terminar de corregir como funciona el cambio del seteo 15 | 16 | */ 17 | OscP5 oscP5; 18 | NetAddress myRemoteLocation; 19 | 20 | //SPOUT 21 | Spout spout; 22 | String sendername; 23 | String[] controlName; 24 | int[] controlType; 25 | float[] controlValue; 26 | String[] controlText; 27 | String UserText = ""; 28 | 29 | //SONIDO 30 | Minim minim; 31 | AudioInput in; 32 | float freq; 33 | float soundsensibility = 500; 34 | MidiBus myBus; 35 | 36 | //Variables que manejan el dibujo 37 | float size = 150; 38 | float size2 = 50; 39 | float modulo=0; 40 | float inc= 0 ; 41 | 42 | //Colores 43 | float hue = 130, sat = 150, bri = 200, trans = 255; 44 | 45 | int col=0; 46 | //Sumator 47 | int sumator = 1; 48 | 49 | //BORDE 50 | 51 | float Bsize = 4, Bhue = 60, Bsat= 200, Bbri = 0, Btrans =255; 52 | 53 | boolean isbackground = false; 54 | boolean israndom = false; 55 | boolean colormanual = true; 56 | boolean isobject = false; 57 | boolean starorpoly = true; 58 | 59 | boolean ismousemode = true; 60 | 61 | int displaymode=3; 62 | /*. 63 | Modo 1) 1 : Dibujo constante, modo standart. siempre está haciendo un dibujo. 64 | Modo 2) 2 : Se modifican los valores de todos los dibujos cada vez que cambias una variable. 65 | Modo 3) 3 : Se modifica el objeto especifico que haya sido seleccionado 66 | Modo 4) 4 : Array tipo matriz para utilizar con la aplicación ControlOSC-MultiBotton Demo 67 | Modo 5) 5 : Modo para mover cada objeto por separado utilizando ControlOSC-MultiTouchXY */ 68 | float speedX =0; 69 | float speedY =0; 70 | 71 | // Variables para el flujo del programa 72 | int cont = 0 ; //Contador que recorre la matris de objetos. 73 | int npoints = 5; //Cantidad de puntas que tiene el poligono. 74 | /* Si tiene 1, se dibujara un circulo 75 | si tiene 2 , una linea, 76 | si tiene 3 , triangulo and so on and so on */ 77 | 78 | int Ccont = 0 ; //Variable que almacena que numero de dibujo se va a modificar; 79 | int [] Ccontgroup = new int[50] ; 80 | 81 | int incdefaults; //Una variable para poner el modulo en valores puros. 82 | 83 | boolean flag = false; // Para que no empiece dibujando el primero. 84 | int flagCcont = 0; // para que el modo 3 funcione bien. 85 | 86 | //Cantidad de objetos en modo array bidimensional 87 | int xcant = 2; 88 | int ycant = 2; 89 | 90 | Spirograph display1 = new Spirograph(width/2, height/2, 50, 70, 0, false, 200, 255, 255, 255, 1, 200, 200, 255, 255, false, 1); 91 | 92 | int cols = 1000; 93 | int rows = 1000; 94 | 95 | Spirograph [][] display2 = new Spirograph[rows][cols]; 96 | Spirograph [] display3 = new Spirograph[1280+768]; 97 | 98 | Spirograph [][] display4 = new Spirograph[8][8]; 99 | boolean showdisplay4[][] = new boolean[8][8]; 100 | 101 | Spirograph [] display5 = new Spirograph[60]; 102 | int Cantobj=10; 103 | 104 | PFont font; 105 | void settings() { 106 | // fullScreen(P3D); 107 | size(1200, 600, P2D); 108 | } 109 | void setup() { 110 | hint(DISABLE_DEPTH_TEST); 111 | font = createFont("Tahoma-Bold", 48); 112 | //cf = new ControlFrame(this,200,600,"box"); 113 | iniciarspout(); 114 | oscP5 = new OscP5(this, 6500); //NUMERITO RE IMPORTANTE ESTE ESTE 115 | myRemoteLocation = new NetAddress("127.0.0.1", 9000); 116 | 117 | textureMode(NORMAL); 118 | background(0); 119 | 120 | colorMode(HSB); 121 | rectMode(CENTER); 122 | //inicializar array de objetos 123 | 124 | for (int i=0; i 0){ 108 | speedY--; 109 | } 110 | 111 | if (displaymode == 2 && ycant > 0) { 112 | ycant--; 113 | } 114 | if(Cantobj > 1){ 115 | Cantobj--; 116 | println("Cantobj", Cantobj); 117 | } 118 | } 119 | 120 | 121 | } 122 | 123 | if (key == '+') { 124 | soundsensibility+=sumator; 125 | println("soundsensibility ", soundsensibility); 126 | } 127 | 128 | if (key == '}' && soundsensibility > 0) { 129 | soundsensibility-=sumator; 130 | println("soundsensibility ", soundsensibility); 131 | } 132 | 133 | if (key == 't') { 134 | size+=sumator; 135 | println("Size :", size); 136 | } 137 | if (key == 'g' && size > sumator) { 138 | size-=sumator; 139 | println("Size :", size); 140 | } 141 | if (key == 'y') { 142 | modulo+=sumator; 143 | println("Modulo :", modulo); 144 | } 145 | if (key == 'h' && modulo > sumator) { 146 | modulo-=sumator; 147 | println("Modulo :", modulo); 148 | } 149 | 150 | if (key == 'u' ) { 151 | inc+=sumator * 0.1; 152 | println("inc :", inc); 153 | } 154 | if (key == 'j' ) { 155 | inc-=sumator * 0.1; 156 | println("inc :", inc); 157 | } 158 | 159 | if (key == 'a') { 160 | fill(0); 161 | rectMode(CORNER); 162 | rect(0,0,width,height); 163 | println("Reset background "); 164 | rectMode(CENTER); 165 | } 166 | if (key == 'd') { 167 | isbackground = !isbackground; 168 | println(isbackground, "isbackground : "); 169 | } 170 | 171 | //RESET 172 | if (key == 'r') { 173 | modulo = 0; 174 | size = 30; 175 | inc = 0; 176 | cont = 0; 177 | hue = 100; 178 | sat = 150; 179 | bri = 255; 180 | 181 | Bhue = 80; 182 | Bsat = 150; 183 | Bbri = 0; 184 | Cantobj = 0; 185 | colormanual = true; 186 | israndom = false; 187 | println("Reset all"); 188 | Ccont = 0 ; 189 | flagCcont=0; 190 | } 191 | 192 | if (key == 'q') { 193 | 194 | israndom = !israndom; 195 | println("Is random : ",israndom); 196 | } 197 | if (key == 'e') { 198 | colormanual = !colormanual; 199 | println("colormanual :",colormanual); 200 | } 201 | if (key == 'i' && colormanual) { 202 | hue+=sumator; 203 | println("hue", hue); 204 | if (hue >= 255) { 205 | hue = 0; 206 | } 207 | } 208 | /*if (key == 'k' && colormanual && hue > 0) { 209 | hue-=sumator; 210 | print("Hue"); 211 | println(hue); 212 | }*/ 213 | 214 | if (key == 'o' && colormanual && sat+sumator < 255) { 215 | sat+=sumator; 216 | println("Saturacion ", sat); 217 | } 218 | if (key == 'l' && colormanual && sat > sumator) { 219 | sat-=sumator; 220 | println("Saturacion ", sat); 221 | } 222 | if (key == 'p' && colormanual && bri+sumator < 255) { 223 | bri+=sumator; 224 | println("Brillo ", bri); 225 | } 226 | if (key == 'ñ' && colormanual && bri > sumator) { 227 | bri-=sumator; 228 | println("Brillo ", bri); 229 | } 230 | if (key == 'n' && trans+sumator <= 255) { 231 | trans+=sumator; 232 | println("Transparencia ", trans); 233 | } 234 | if (key == 'b' && trans > sumator) { 235 | trans-=sumator; 236 | println("Transparencia ", trans); 237 | } 238 | 239 | if (key == 'm') { 240 | ismousemode = !ismousemode; 241 | } 242 | if (key == 'v') { 243 | displaymode++; 244 | if (displaymode == 6) { 245 | displaymode = 1; 246 | } 247 | println("Display Mode : ", displaymode); 248 | } 249 | if (key == 'c' && cont > 0 ) { 250 | cont--; 251 | } 252 | if (key == 'f' && Ccont > 0 && cont > 1) { 253 | Ccont--; 254 | } 255 | 256 | if (key == 'z') { 257 | 258 | npoints++; 259 | print("npoints"); 260 | println(npoints); 261 | } 262 | 263 | if (key == 'x' && npoints > 1) { 264 | npoints--; 265 | print("npoints"); 266 | println(npoints); 267 | } 268 | 269 | if (key == '1' && Bsize > 0) { 270 | Bsize-= sumator; 271 | println("Bsize", Bsize); 272 | } 273 | 274 | if (key == '2' && Bsize+sumator <= 255 ) { 275 | Bsize+= sumator; 276 | println("Bsize", Bsize); 277 | } 278 | if (key == '3') { 279 | Bhue+= sumator; 280 | 281 | if (Bhue >= 255) { 282 | Bhue = 0; 283 | } 284 | println("Bhue", Bhue); 285 | } 286 | if (key == '4' && Bsat >= sumator) { 287 | Bsat-=sumator; 288 | println("Bsat", Bsat); 289 | } 290 | if (key == '5' && Bsat+sumator <= 255) { 291 | Bsat+=sumator; 292 | println("Bsat", Bsat); 293 | } 294 | if (key == '6' && Bbri >=sumator ) { 295 | Bbri-=sumator; 296 | println("Bbri", Bbri); 297 | } 298 | if (key == '7' && Bbri+sumator <=255) { 299 | Bbri+=sumator; 300 | println("Bbri", Bbri); 301 | } 302 | if (key == '8' && Btrans+sumator <= 255) { 303 | Btrans+=sumator; 304 | println("Btrans", Btrans); 305 | } 306 | if (key == '9' && Btrans >= sumator) { 307 | Btrans-=sumator; 308 | println("Btrans", Btrans); 309 | } 310 | if (key == '+') { 311 | sumator++; 312 | println("Sumator",sumator); 313 | } 314 | 315 | if (key == '-' && sumator > 0) { 316 | sumator--; 317 | println("Sumator",sumator); 318 | } 319 | if (key == 'b'){ 320 | 321 | starorpoly = !starorpoly; 322 | 323 | } 324 | if (key == ' ' && Ccont <= cont && displaymode == 3) { 325 | Ccont++; 326 | pushMatrix(); 327 | 328 | translate(0,0,+20); 329 | popMatrix(); 330 | if (Ccont == cont) { 331 | Ccont = 0; 332 | flagCcont = 1; 333 | } 334 | 335 | if (flagCcont == 0) { 336 | flagCcont = 1; 337 | } 338 | } 339 | 340 | if(key == 'B'){ 341 | saveFrame("img/####-spiro.jpg"); 342 | } 343 | } 344 | 345 | void mouseWheel(MouseEvent event) { 346 | 347 | //float e = event.getCount(); 348 | // println(e); 349 | if (event.getCount() == 1 || ( (event.getCount() == -1) && sumator > 1) ) { 350 | sumator+= event.getCount(); 351 | } 352 | println("Sumator : ", sumator); 353 | } -------------------------------------------------------------------------------- /deprecated/Controls old.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpupper/Spyrographics/4ca62a6bfaa28ac68411b7bbecb3ae717cf25f87/deprecated/Controls old.txt -------------------------------------------------------------------------------- /functions.pde: -------------------------------------------------------------------------------- 1 | 2 | void iniciarMinim(){ 3 | 4 | //SONIDO : 5 | minim = new Minim(this); 6 | // minim.debugOn(); 7 | in = minim.getLineIn(Minim.STEREO, 512); 8 | 9 | freq = abs( in.left.get(250)*1024 ) ; 10 | } -------------------------------------------------------------------------------- /midibus.pde: -------------------------------------------------------------------------------- 1 | void iniciarMidibus(){ 2 | // List all our MIDI devices 3 | // MidiBus.list(); 4 | // Connect to one of the devices 5 | myBus = new MidiBus(this, "nanoKONTROL2 1 SLIDER/KNOB","nanoKONTROL2 1 CTRL"); 6 | } 7 | 8 | void controllerChange(int channel, int number, int value) { 9 | // Receive a controllerChange 10 | println(); 11 | println("Controller Change:"); 12 | println("--------"); 13 | println("Channel:"+channel); 14 | println("Number:"+number); 15 | println("Value:"+value); 16 | 17 | 18 | //TAMAÑO 19 | 20 | if (number == 38){ 21 | xcant++; 22 | println("xcant",xcant); 23 | } 24 | if (number == 54 && xcant>2){ 25 | xcant--; 26 | println("xcant",xcant); 27 | } 28 | 29 | if (number == 39){ 30 | ycant++; 31 | println("cant",ycant); 32 | } 33 | if (number == 55 && ycant>2){ 34 | ycant--; 35 | println("ycant",ycant); 36 | } 37 | 38 | 39 | 40 | if (number == 16) { 41 | size = map(value,0,127,0,width); 42 | } 43 | 44 | //TAMAÑO DE LA CIRCUNFERENCIA 45 | if (number == 17) { 46 | modulo = map(value,0,127,0,400); 47 | } 48 | 49 | //EFECTO ESPIROGRAFICO 50 | if (number == 18) { 51 | inc = map(value,0,127,0,width /5) * 0.1; 52 | } 53 | 54 | if (number == 19) { 55 | soundsensibility = map(value,0,127,0,1024); 56 | } 57 | //HUE 58 | if (number == 20) { 59 | hue = map(value,0,127,0,255); 60 | } 61 | if (number == 21) { 62 | sat = map(value,0,127,0,255); 63 | } 64 | if (number == 22) { 65 | bri = map(value,0,127,0,255); 66 | } 67 | if (number == 23) { 68 | trans = map(value,0,127,0,255); 69 | } 70 | 71 | //Poligono 72 | 73 | if (number == 59 ){ 74 | 75 | npoints++; 76 | println("Npoints",npoints); 77 | } 78 | if (number == 58 && npoints > 1){ 79 | npoints--; 80 | println("Npoints",npoints); 81 | } 82 | 83 | //stop 84 | if (number == 42){ 85 | cont = 0; 86 | Ccont = 0; 87 | flagCcont = 0; 88 | } 89 | 90 | if (number == 61 && cont > 0) { 91 | cont--; 92 | } 93 | 94 | if (number == 62){ 95 | cont++; 96 | } 97 | 98 | //COLOR 99 | if (number == 32){ 100 | colormanual = !colormanual; 101 | 102 | } 103 | 104 | //Random 105 | if (number == 48){ 106 | 107 | israndom = !israndom; 108 | } 109 | 110 | 111 | //modo limpia siempre 112 | if (number == 65){ 113 | displaymode++; 114 | if (displaymode == 4){ 115 | displaymode = 1; 116 | } 117 | println("Displaymode = ",displaymode); 118 | } 119 | 120 | if (number == 33){ 121 | background(255); 122 | } 123 | 124 | if (number == 49){ 125 | isbackground = !isbackground; 126 | } 127 | 128 | if (number == 0 ){ 129 | Bsize = map(value,0,127,0,150); 130 | 131 | print("Bsize"); 132 | println(Bsize); 133 | } 134 | 135 | if (number == 1){ 136 | Bhue = map(value,0,127,0,255); 137 | 138 | print("Bhue"); 139 | println(Bhue); 140 | 141 | } 142 | 143 | if (number == 2){ 144 | Bsat = map(value,0,127,0,255); 145 | print("Bsat"); 146 | println(Bsat); 147 | } 148 | 149 | if (number == 3){ 150 | Bbri = map(value,0,127,0,255); 151 | print("Bbri"); 152 | println(Bbri); 153 | } 154 | 155 | if (number == 4){ 156 | Btrans = map(value,0,127,0,255); 157 | print("Btrans"); 158 | println(Btrans); 159 | } 160 | 161 | if (number == 70){ 162 | switch (incdefaults){ 163 | case 0 : 164 | incdefaults++; 165 | inc = 8; 166 | break; 167 | case 1 : 168 | incdefaults++; 169 | inc = 15; 170 | break; 171 | case 2 : 172 | incdefaults = 0; 173 | inc = 20; 174 | break; 175 | } 176 | } 177 | 178 | if (number == 50 && Ccont > 0){ 179 | if (Ccont == 0){ 180 | 181 | } 182 | Ccont--; 183 | } 184 | if (number == 41 && Ccont <= cont && displaymode == 3) { 185 | 186 | println("Ccont ",Ccont); 187 | 188 | if (Ccont >= cont){ 189 | Ccont = 0; 190 | } 191 | Ccont++; 192 | 193 | if (flagCcont == 0){ 194 | 195 | flagCcont = 1; 196 | } 197 | println("Ccont ",Ccont); 198 | // println(con 199 | } 200 | 201 | if (number == 6) { 202 | speedX = map(value,0,127,0,10); 203 | println("SpeedX",speedX); 204 | } 205 | if (number == 7) { 206 | speedY = map(value,0,127,0,10); 207 | println("SpeedX",speedY); 208 | } 209 | 210 | } -------------------------------------------------------------------------------- /osccontrols.pde: -------------------------------------------------------------------------------- 1 | void oscEvent(OscMessage theOscMessage) { 2 | /* print the address pattern and the typetag of the received OscMessage */ 3 | /* print("### received an osc message.");} 4 | print(" addrpattern: "+theOscMessage.addrPattern()); 5 | println(" typetag: "+theOscMessage.typetag());*/ 6 | 7 | int res = parseInt(theOscMessage.addrPattern().substring(7,theOscMessage.addrPattern().length())) ; 8 | print(" addrpattern: "+theOscMessage.addrPattern()); 9 | 10 | 11 | if (displaymode == 4){ 12 | println("res :",res); 13 | //println("String lenght : ",theOscMessage.addrPattern().length()); 14 | // println("I : ",I); 15 | // println("D : ",D); 16 | 17 | int L=0; 18 | for (int i = 0 ; i<=7; i++){ 19 | for (int k = 0 ; k<=7; k++) { 20 | 21 | 22 | if (L == res){ 23 | println("CAMBIO : ",L); 24 | showdisplay4[k][i] = !showdisplay4[k][i]; 25 | 26 | } 27 | L++; 28 | println("showdisplay4[",i,"][",k,"] : ",showdisplay4[k][i]); 29 | println("L : ",L); 30 | } 31 | 32 | 33 | println(""); 34 | } 35 | println(theOscMessage.addrPattern()); 36 | // println(theOscMessage.addrPattern().charAt(7)); 37 | } 38 | 39 | if (displaymode == 5){ 40 | 41 | //int res = parseInt(theOscMessage.addrPattern().substring(7,theOscMessage.addrPattern().length())) ; 42 | println(" addrpattern: "+theOscMessage.addrPattern()); 43 | println("Variable X:",theOscMessage.get(1).floatValue()); 44 | println("Variable Y:",theOscMessage.get(0).floatValue()); 45 | 46 | float xpos = theOscMessage.get(1).floatValue(); 47 | float ypos = theOscMessage.get(0).floatValue(); 48 | 49 | xpos = map(xpos,0,1,0,width); 50 | ypos = map(ypos,1,0,0,height); 51 | 52 | display5[res].setPos(xpos,ypos); 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /spirograph.pde: -------------------------------------------------------------------------------- 1 | class Spirograph { 2 | 3 | float x; 4 | float y; 5 | 6 | float xpos; 7 | float ypos; 8 | 9 | float angulo_fijo = 0; 10 | float angulo=0; 11 | 12 | float size,modulo,inc; 13 | float size2; 14 | 15 | boolean colormanual; 16 | float hue, sat, bri, trans; 17 | 18 | float Bsize, Bhue, Bsat, Bbri, Btrans ; 19 | 20 | boolean israndom = false;; 21 | int npoints = 8; 22 | 23 | //Booleanos que indican para que lado debe moverse 24 | boolean moveX; 25 | boolean moveY; 26 | boolean starorpoly; 27 | 28 | float speedX; 29 | float speedY; 30 | 31 | 32 | Spirograph(/*Variables de posición */ float tempxpos,float tempypos, 33 | /*Variables de movimiento */ float tempsize, float tempmodulo, float tempinc, 34 | /*Variables de color */ boolean tempcolormanual, float temphue, float tempsat, float tempbri, float temptrans, 35 | /*Variables del borde*/ float tempBsize, float tempBhue, float tempBsat, float tempBbri, float tempBtrans, 36 | /*Efecto random y puntas del poligono */ boolean tempisrandom, int tempnpoints ){ 37 | 38 | xpos = tempxpos; 39 | ypos = tempypos; 40 | size = tempsize; 41 | modulo = tempmodulo; 42 | inc = tempinc; 43 | 44 | colormanual = tempcolormanual; 45 | hue = temphue; 46 | sat = tempsat; 47 | bri = tempbri; 48 | trans = temptrans; 49 | 50 | Bsize = tempBsize; 51 | Bhue = tempBhue; 52 | Bsat = tempBsat; 53 | Bbri = tempBbri; 54 | Btrans = tempBtrans; 55 | israndom = tempisrandom; 56 | npoints = tempnpoints; 57 | } 58 | 59 | void setSettings(float Csize,float _size2, float Cmodulo, float Cinc 60 | ,boolean Ccolormanual,float Chue,float Csat,float Cbri, float Ctrans 61 | ,float CBsize, float CBhue, float CBsat, float CBbri,float CBtrans 62 | ,boolean Cisrandom,int Cnpoints,boolean _starorpoly,float _speedX,float _speedY){ 63 | size = Csize; 64 | size2 = _size2; 65 | modulo = Cmodulo; 66 | inc = Cinc; 67 | 68 | colormanual = Ccolormanual; 69 | hue = Chue; 70 | sat = Csat; 71 | bri = Cbri; 72 | trans = Ctrans; 73 | 74 | Bsize = CBsize; 75 | Bhue = CBhue; 76 | Bsat = CBsat; 77 | Bbri = CBbri; 78 | Btrans = CBtrans; 79 | 80 | israndom =Cisrandom; 81 | npoints = Cnpoints; 82 | starorpoly = _starorpoly; 83 | 84 | 85 | speedX = _speedX; 86 | speedY = _speedY; 87 | } 88 | 89 | void display() 90 | { 91 | setBorde(); 92 | setColor(); 93 | pushMatrix(); 94 | angulo_fijo+=inc; //Cuanto mayor sea inc, mas sera el efecto espirografico. 95 | angulo= angulo -10; 96 | x=(cos(radians(-(angulo)))*modulo); 97 | y=(sin(radians(-(angulo)))*modulo); 98 | 99 | translate(this.xpos - modulo +x, this.ypos -y); 100 | rotate(radians( angulo_fijo )); //Este rotate genera el efecto espirografico. 101 | if (keyPressed && key == 'k'){ 102 | 103 | angulo = 0; 104 | angulo_fijo = 0; 105 | } 106 | 107 | if(israndom){ 108 | //polygon(modulo+modulo/2,modulo-modulo/2,size,npoints); 109 | 110 | //star(modulo+modulo/2,modulo-modulo/2,size,size2,npoints); 111 | starOrpolygon(starorpoly); 112 | } 113 | else { 114 | //polygon(modulo+modulo/2,modulo-modulo/2,size,npoints); 115 | 116 | // star(modulo+modulo/2,modulo-modulo/2,size,size2,npoints); 117 | starOrpolygon(starorpoly); 118 | } 119 | popMatrix(); 120 | } 121 | 122 | void setColor() { 123 | if (colormanual){ 124 | fill(hue,sat,bri,trans); 125 | } 126 | else{ 127 | fill(col,255,255,trans); 128 | col++; 129 | if (col == 255) { 130 | col = 0 ; 131 | } 132 | } 133 | } 134 | void setPos(float tempxpos,float tempypos) { 135 | xpos = tempxpos; 136 | ypos = tempypos; 137 | } 138 | void move(){ 139 | 140 | if (xpos >= width || xpos <= 0){ 141 | moveX = !moveX; 142 | } 143 | if (ypos >= height || ypos <= 0){ 144 | moveY = !moveY; 145 | } 146 | if (moveX){ 147 | xpos += speedX; 148 | } 149 | else { 150 | xpos -= speedX; 151 | } 152 | if (moveY){ 153 | ypos += speedY; 154 | } 155 | else { 156 | ypos -= speedY; 157 | } 158 | } 159 | void setBorde(){ 160 | stroke(Bhue,Bsat,Bbri,Btrans); 161 | strokeWeight(Bsize); 162 | } 163 | void starOrpolygon(boolean starorpoly){ 164 | 165 | if (starorpoly){ 166 | star(modulo+modulo/2,modulo-modulo/2,size,size2,npoints); 167 | 168 | 169 | } 170 | 171 | else { 172 | polygon(modulo+modulo/2, modulo-modulo/2, size,npoints); 173 | } 174 | } 175 | void polygon(float x, float y, float radius, int npoints) { 176 | if (npoints <= 1){ 177 | if(israndom){ 178 | ellipse(modulo+modulo/2,modulo-modulo/2,random(size),random(size)); 179 | } 180 | else{ 181 | ellipse(modulo+modulo/2,modulo-modulo/2,size,size); 182 | } 183 | } 184 | if (npoints == 2 ) { 185 | strokeWeight(Bsize); 186 | line(modulo+modulo/2, modulo+modulo/2,size, size); 187 | } 188 | else if(npoints == 4){ 189 | if(israndom){ 190 | rect(modulo+modulo/2,modulo-modulo/2,random(size),random(size)); 191 | } 192 | else{ 193 | rect(modulo+modulo/2,modulo-modulo/2,size,size); 194 | } 195 | } 196 | else { 197 | if(israndom){ 198 | float angle = TWO_PI / npoints; 199 | beginShape(); 200 | for (float a = 0; a < TWO_PI; a += angle) { 201 | float sx = x + cos(a) * radius; 202 | float sy = y + sin(a) * radius; 203 | vertex(random(sx), random(sy)); 204 | } 205 | endShape(CLOSE); 206 | } 207 | else{ 208 | float angle = TWO_PI / npoints; 209 | beginShape(); 210 | for (float a = 0; a < TWO_PI; a += angle) { 211 | float sx = x + cos(a) * radius; 212 | float sy = y + sin(a) * radius; 213 | vertex(sx, sy); 214 | } 215 | endShape(CLOSE); 216 | } 217 | } 218 | } 219 | 220 | void star(float x, float y, float radius1, float radius2, int npoints) { 221 | if (npoints == 1){ 222 | npoints = 2; 223 | } 224 | float angle = TWO_PI / npoints; 225 | float halfAngle = angle/2.0; 226 | beginShape(); 227 | for (float a = 0; a < TWO_PI; a += angle) { 228 | float sx = x + cos(a) * radius2; 229 | float sy = y + sin(a) * radius2; 230 | if (israndom){ 231 | vertex(random(sx), random(sy)); 232 | } 233 | else{ 234 | vertex(sx, sy); 235 | } 236 | 237 | sx = x + cos(a+halfAngle) * radius1; 238 | sy = y + sin(a+halfAngle) * radius1; 239 | vertex(sx, sy); 240 | } 241 | endShape(CLOSE); 242 | } 243 | } -------------------------------------------------------------------------------- /spout.pde: -------------------------------------------------------------------------------- 1 | void iniciarspout(){ 2 | spout = new Spout(this); 3 | 4 | sendername = "Spyrographics"; 5 | //spout.initSender(sendername, width, height); 6 | spout.createSender(sendername, width, height); 7 | 8 | controlName = new String[20]; 9 | controlType = new int[20]; 10 | controlValue = new float[20]; 11 | controlText = new String[20]; 12 | 13 | //pepe.initSender(sendername, width, height); 14 | spout.openSpoutControls(sendername); 15 | 16 | } 17 | 18 | void ControlesSpout(){ 19 | int nControls = spout.checkSpoutControls(controlName, controlType, controlValue, controlText); 20 | //print("nControls = " + nControls + "n"); 21 | if (nControls > 0) { 22 | for (int i = 0; i < nControls; i++) { 23 | //print("(" + i + ") : [" + controlName[i] + "] : Type [" + controlType[i] + "] : Value [" + controlValue[i] + "] : Text [" + controlText[i] + "]" + "n"); 24 | 25 | if (controlName[i].equals("Size")) { 26 | size = controlValue[i]; 27 | } 28 | if (controlName[i].equals("Size2")) { 29 | size2 = controlValue[i]; 30 | } 31 | if (controlName[i].equals("modulo")) { 32 | modulo = controlValue[i]; 33 | } 34 | if (controlName[i].equals("Rotation Speed")) { 35 | inc = controlValue[i]; 36 | } 37 | if (controlName[i].equals("hue")) { 38 | hue = controlValue[i]; 39 | } 40 | if (controlName[i].equals("sat")) { 41 | sat = controlValue[i]; 42 | } 43 | if (controlName[i].equals("bri")) { 44 | bri = controlValue[i]; 45 | } 46 | if (controlName[i].equals("trans")) { 47 | trans = controlValue[i]; 48 | } 49 | if (controlName[i].equals("Bhue")) { 50 | Bhue = controlValue[i]; 51 | } 52 | if (controlName[i].equals("Bsat")) { 53 | Bsat = controlValue[i]; 54 | } 55 | if (controlName[i].equals("Bbri")) { 56 | Bbri = controlValue[i]; 57 | } 58 | if (controlName[i].equals("Btrans")) { 59 | Btrans = controlValue[i]; 60 | } 61 | if (controlName[i].equals("X speed")) { 62 | speedX = controlValue[i]; 63 | } 64 | if (controlName[i].equals("Y speed")) { 65 | speedY = controlValue[i]; 66 | } 67 | if (controlName[i].equals("Bsize")) { 68 | Bsize = controlValue[i]; 69 | } 70 | if (controlName[i].equals("Sonido")) { 71 | soundsensibility = controlValue[i]; 72 | } 73 | if (controlName[i].equals("BGrefresh")){ 74 | isbackground = (boolean)(controlValue[i] == 1); 75 | } 76 | if (controlName[i].equals("RandomPoints")){ 77 | israndom = (boolean)(controlValue[i] == 1); 78 | } 79 | if (controlName[i].equals("Npoints")) { 80 | npoints = parseInt(controlValue[i]); 81 | } 82 | if (controlName[i].equals("StarOrPolygon")){ 83 | starorpoly = (boolean)(controlValue[i] == 1); 84 | } 85 | } 86 | } 87 | 88 | 89 | 90 | } --------------------------------------------------------------------------------