Sunday, May 1, 2011

Final Year Project Video

This is my video for the final year project. This video is created using Adobe Premiere Pro and it is my second time using it >.< Feel free to give me advices and comments ^^

Friday, April 29, 2011

Setting Up

Here are some picture when I set up the installation. Picture quality is quite bad because taken from the video.


1. Set up projector.


2. Plug in the wires in my own desktop.


3. Stick the Arduino and vibration sensor under the board.


4. Friend help testing the installation.


5. Installation working perfectly.

Artist Statement

This installation is a combination of drum therapy, music therapy and art therapy to aid people in release stress. Through this installation, I hopes that users can experience a new way to express their feeling and daily stress with new media nowadays.

I was motivated by the news and people around me who cannot manage their stress efficiently. I also have my own stress to deal with every day. Stress have been an old issue for long time ago but people nowadays are getting worst in manage their daily tension. Stress is a pushing hand but it can be also a deadly poison for individual. People are working or study hard to pursue the luxury and survive in society but they forgot to slow down their living steps. And these bring to the cases related to mental health like depression, anxiety and insomnia, which increasing every day. In this installation users not only can express their feeling in his/her very own world but also help to find back their self-cognitive through the beating sound, music and colors.

Poster

The poster for my installation is finally comes out! Here is it:



Warning!!! Its hot!

Monday, April 25, 2011

Drum Sound in Flash

Putting a drum sound in flash is quite easy actually. But for me the challenge thing is to call out the drum sound using AS3. Luckily the experimental period is quite smooth. First, I import the packages that will be using in flash like below:


import flash.media.Sound;
import flash.media.SoundChannel;


After that, put the following action script under the private KeyPress function:


var my_sound:drumsound = new drumsound();
var my_channel:SoundChannel = new SoundChannel();

if (event.keyCode==Keyboard.SPACE) {
my_channel = my_sound.play();
}


Its done! Drum sound will come out when SPACE bar is press. Its time for final set up!!!!

Sunday, April 24, 2011

Arduino and Java - Part 2

Ok. The plan that modify the Java script inside Serial Midi Converter was failed. This is because one serial port can't have two kind of converter to convert the message. I have come out with another solution which the serial port only detect the keypress for SPACE and the drum sound will be played back inside flash. This is the last way for me to simplify the convert of signal received through serial port. The code that we'll using is the tutorial that i posted in previous post. I've seek help from my house mate who is also a IT student which good in coding and Java. This is the code after edit:


package serialtalk;

import java.io.InputStream;
import java.io.OutputStream;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;
import java.util.Enumeration;
import java.awt.Robot;
import java.awt.event.KeyEvent;

public class Main implements SerialPortEventListener {
SerialPort serialPort;
static Robot robot;
/** The port we're normally going to use. */
private static final String PORT_NAMES[] = {
"/dev/tty.usbserial-A9007UX1", // Mac OS X
"/dev/ttyUSB0", // Linux
"COM11", // Windows
};
/** Buffered input stream from the port */
private InputStream input;
/** The output stream to the port */
private OutputStream output;
/** Milliseconds to block while waiting for port open */
private static final int TIME_OUT = 2000;
/** Default bits per second for COM port. */
private static final int DATA_RATE = 9600;

public void initialize() {
CommPortIdentifier portId = null;
Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();

// iterate through, looking for the port
while (portEnum.hasMoreElements()) {
CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement();
for (String portName : PORT_NAMES) {
if (currPortId.getName().equals(portName)) {
portId = currPortId;
break;
}
}
}

if (portId == null) {
System.out.println("Could not find COM port.");
return;
}

try {
// open serial port, and use class name for the appName.
serialPort = (SerialPort) portId.open(this.getClass().getName(),
TIME_OUT);

// set port parameters
serialPort.setSerialPortParams(DATA_RATE,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);

// open the streams
input = serialPort.getInputStream();
output = serialPort.getOutputStream();

// add event listeners
serialPort.addEventListener(this);
serialPort.notifyOnDataAvailable(true);
} catch (Exception e) {
System.err.println(e.toString());
}
}

/**
* This should be called when you stop using the port.
* This will prevent port locking on platforms like Linux.
*/
public synchronized void close() {
if (serialPort != null) {
serialPort.removeEventListener();
serialPort.close();
}
}

/**
* Handle an event on the serial port. Read the data and print it.
*/
public synchronized void serialEvent(SerialPortEvent oEvent) {
System.out.println("\n *** [VIBRATION DETECTED] *** ");
//robot.mouseMove(0, 0);
robot.keyPress(KeyEvent.VK_SPACE);
if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
try {
int available = input.available();
byte chunk[] = new byte[available];
input.read(chunk, 0, available);

// Displayed results are codepage dependent
System.out.print(new String(chunk));
} catch (Exception e) {
System.err.println(e.toString());
}
}
// Ignore all the other eventTypes, but you should consider the other ones.
}

public static void main(String[] args) throws Exception {
Main main = new Main();
robot = new Robot();

main.initialize();
System.out.println("Started");
}
}


We used "Robot" function to trigger the keypress "SPACE" once it detected signal received from Arduino board. "COM11" is the USB serial port that I'm using woth Arduino board. Every different computer will have different serial number for the port. So if the installation need to present at another computer, this is the one that need to be change according to the port number at that computer, and whole Java script will need to compile again. Below is the output in NetBean after it detect vibration signal in Arduino board:



It successfully to receive signal from Arduino! And after we test with the flash, it successfully to trigger SPACE key as well. This indeed is a big move toward the success in my installation. I want to thanks Jay Lim in helping me with his professional knowledge.

Thursday, April 21, 2011

Arduino and Java

I've found a tutorial online that related to virtual serial port writing. I've seek help from my house mate which is a IT student because this need a strong IT and Java programming knowledge. Firstly we installed the Netbean software as written in the tutorial:



After that, we import some Arduino IDE libraries and configurations:



After that, we put in the codes that given by the website:


package serialtalk;

import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import java.io.InputStream;
import java.io.OutputStream;
import processing.app.Preferences;

public class Main {
static InputStream input;
static OutputStream output;

public static void main(String[] args) throws Exception{
Preferences.init();
System.out.println("Using port: " + Preferences.get("serial.port"));
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(
Preferences.get("serial.port"));

SerialPort port = (SerialPort)portId.open("serial talk", 4000);
input = port.getInputStream();
output = port.getOutputStream();
port.setSerialPortParams(Preferences.getInteger("serial.debug_rate"),
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
while(true){
while(input.available()>0) {
System.out.print((char)(input.read()));
}
}
}
}


We programmed the java file inside Serial Midi Converter hope that when it receive the sound signal fron serial port, it will also trigger virtual space button so that the splash effects will be played. We've tried whole night in figuring where to put in VK_SPACE but it still no improvement. Time really flies that it already early in the morning after we spent so many time on it but show nothing. We will continue to do it after have a sleep first >.<...

Reference:
1. http://silveiraneto.net/2009/03/01/arduino-and-java/