top of page

Flocking Keyboard

simulating flock behvior with keyboard

Fun with typing

How to make typing more interesting

The other day, I was reading the book “Out of Control” written by Kevin Kelly, and the idea of “ flocking behavior” drew my attention. I was surprised that following very simple and basic rules, a group of individual animals could demonstrate incredible swarm intelligence. In 1987 Craig Reynolds first simulated flocking behavior on a computer, which then was used to successfully simulate a scene of flocking bats in the film Batman Returns. I can’t help thinking whether we can use “flocking behavior” to make our interaction with computer more interesting, or more like we are interacting with a live creature but a cold and lifeless machine, so this project is aimed to make typing, one of the most basic way of our interaction with computer, fun and appealing. 

Initial Research

Separation

Alignment

Cohesion

Basic models of flocking behavior are controlled by three simple rules:

 

1    Separation - avoid crowding neighbors (short range repulsion)

2    Alignment - steer towards average heading of neighbors

3    Cohesion - steer towards average position of neighbors (long range attraction)

Such complicated behavior could be simulated just following these three simple rules

What if we apply the flocking behavior to the basic interactive way with a computer, such as typing

 

Could we make every small letter acts with swarm intelligence

Project Constructure

The project combines visual, touch and auditory to create a multi-dimensional sensation. The projector locates above the Bluetooth keyboard, and the image of the projector is adjusted to perfectly match the keyboard size. Therefore, as soon as the user presses the keyboard, the projected image of keyboard letter emitted from the key and then explodes into a few simultaneously triggering piano sound, then the letter starts to fly as same as the bird flocking behavior.

Final video

import ddf.minim.*;

Minim minim;

AudioSample press[]=new AudioSample[26];

ArrayList<Particle> ps;

PImage []letter=new PImage[26];

PImage keyboard;

Flock flock;

void setup(){

    minim = new Minim(this);

     for(int i=0;i<26;i++){

        int f=i+1;

        letter[i]=loadImage(f+".png");

        press[i] = minim.loadSample( f+".mp3", 100 );

      }

    fullScreen();

    flock = new Flock();

    for (int i = 0; i < 200; i++) {

        int uu=int(random(1,25));

        Boid b = new Boid(width/2,height/2,uu);

        flock.addBoid(b);

     }

     ps=new ArrayList<Particle>();

}

void draw(){

    blendMode(ADD);

    background(0);

     run(); 

    flock.run();

}

Coding with processing

The interactive program is written by processing, and the flocking simulation was inspired by Daniel Shiffman, I import ddf.minim library to load and play sound files in the program. So every time people press the keyboard, the piano sound follows. 

Parts of the code

import ddf.minim.*;

Minim minim;

AudioSample press[]=new AudioSample[26];

ArrayList<Particle> ps;

PImage []letter=new PImage[26];

PImage keyboard;

Flock flock;

void setup(){

    minim = new Minim(this);

     for(int i=0;i<26;i++){

        int f=i+1;

        letter[i]=loadImage(f+".png");

        press[i] = minim.loadSample( f+".mp3", 100 );

      }

    fullScreen();

    flock = new Flock();

    for (int i = 0; i < 200; i++) {

        int uu=int(random(1,25));

        Boid b = new Boid(width/2,height/2,uu);

        flock.addBoid(b);

     }

     ps=new ArrayList<Particle>();

}

void draw(){

    blendMode(ADD);

    background(0);

     run(); 

    flock.run();

}

Coding with processing

The interactive program is written by processing, and the flocking simulation was inspired by Daniel Shiffman, I import ddf.minim library to load and play sound files in the program. So every time people press the keyboard, the piano sound follows. 

I am an interaction & UX designer, a digital artist, and an independent writer. I love creative coding and have a huge passion for the combination of art, design, and technology. My essay won 2012 John Mooers Critic Prize, and my artworks have been widely shown in galleries and museums such as CAFAM, Today Art Museum, etc. I am also the co-founder of Independent art space ON SPACE. I am currently in pursuit of Master of Design in Interaction Design (MDes)  degree in Carnegie Mellon University. I work at Google Daydream as a UX designer. Please check my book on AR design as a part of my Master thesis project.

Follow me on Twitter, and connect me on LinkedIn

Learn more about my artworks please see:   www.wushengzhi.com >

Learn more about ON SPACE  please see:  www.onspace.top >

© 2023 by wushengzhi. all right reserved

bottom of page