├── images ├── candle1.gif ├── candle10.gif ├── candle11.gif ├── candle12.gif ├── candle13.gif ├── candle14.gif ├── candle15.gif ├── candle16.gif ├── candle2.gif ├── candle3.gif ├── candle4.gif ├── candle5.gif ├── candle6.gif ├── candle7.gif ├── candle8.gif └── candle9.gif ├── README.md └── candle.pde /images/candle1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle1.gif -------------------------------------------------------------------------------- /images/candle10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle10.gif -------------------------------------------------------------------------------- /images/candle11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle11.gif -------------------------------------------------------------------------------- /images/candle12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle12.gif -------------------------------------------------------------------------------- /images/candle13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle13.gif -------------------------------------------------------------------------------- /images/candle14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle14.gif -------------------------------------------------------------------------------- /images/candle15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle15.gif -------------------------------------------------------------------------------- /images/candle16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle16.gif -------------------------------------------------------------------------------- /images/candle2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle2.gif -------------------------------------------------------------------------------- /images/candle3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle3.gif -------------------------------------------------------------------------------- /images/candle4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle4.gif -------------------------------------------------------------------------------- /images/candle5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle5.gif -------------------------------------------------------------------------------- /images/candle6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle6.gif -------------------------------------------------------------------------------- /images/candle7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle7.gif -------------------------------------------------------------------------------- /images/candle8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle8.gif -------------------------------------------------------------------------------- /images/candle9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diracdeltas/birthday/master/images/candle9.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | birthday 2 | ======== 3 | 4 | A cute Processing script that lets someone blow out a candle on their birthday. 5 | Just run it and blow on your computer. Probably works best if you blow at the microphone. 6 | Tested with Processing 2.0b6. 7 | -------------------------------------------------------------------------------- /candle.pde: -------------------------------------------------------------------------------- 1 | // 2 | // candle.pde 3 | // 4 | // simple Processing script that lets anyone blow out a candle 5 | // (given sufficient air pressure differential) 6 | // 7 | // Author: Yan Zhu 8 | // License: GPL v3 9 | 10 | import com.jsyn.io.*; 11 | import com.jsyn.data.*; 12 | import com.jsyn.util.*; 13 | import com.jsyn.instruments.*; 14 | import com.jsyn.*; 15 | import com.jsyn.exceptions.*; 16 | import com.jsyn.apps.*; 17 | import com.jsyn.devices.*; 18 | import com.jsyn.ports.*; 19 | import com.jsyn.score.*; 20 | import com.jsyn.midi.*; 21 | import com.jsyn.scope.swing.*; 22 | import com.jsyn.engine.*; 23 | import com.jsyn.swing.*; 24 | import com.jsyn.devices.javasound.*; 25 | import com.jsyn.scope.*; 26 | import com.jsyn.util.soundfile.*; 27 | import com.jsyn.unitgen.*; 28 | import com.jsyn.devices.jportaudio.*; 29 | 30 | import pitaru.sonia_v2_9.*; 31 | 32 | PImage[] images = new PImage[16]; 33 | 34 | void setup(){ 35 | for ( int i = 1; i< images.length + 1; i++ ) 36 | { 37 | images[i-1] = loadImage( "/images/candle" + i + ".gif" ); 38 | }; 39 | 40 | size(400,534); 41 | frameRate(5); 42 | Sonia.start(this); // Start Sonia engine. 43 | LiveInput.start(256); // Start LiveInput and return 256 FFT frequency bands. 44 | } 45 | 46 | void draw(){ 47 | getSpectrum(); // Show FFT reading 48 | 49 | } 50 | 51 | void getSpectrum(){ 52 | strokeWeight(1); 53 | stroke(0,230,0); 54 | // populate the spectrum array with FFT values. 55 | LiveInput.getSpectrum(); 56 | image(images[constrain(floor((LiveInput.spectrum[0])/50),0,14)],0,0); 57 | 58 | } 59 | 60 | public void stop(){ 61 | Sonia.stop(); 62 | super.stop(); 63 | } 64 | --------------------------------------------------------------------------------