New Projects and Progress

Since last time, I've been working on couple of new projects. They are all in progress but here is a sneak peek at one of them; hopefully will get it done soon.

I also started building my own DIY stringed e-instrument, which will hopefully be playable in the end. Maybe I will consider making a demo and uploading it to YouTube, who knows. Highly influential videos of cigar box guitars got me going. More coming soon.



A Guide for Creating Basic Geometric Illustrations

Processing Icon

Hey all,

Apart from sound design & field recording for a short movie project, I've taken part in another exhibition at a local bar (called Arkaoda) in Kadikoy, Istanbul. Lately I've been lurking around and wanted to create something graphical for myself. It is pretty basic, but it looks nice and it forms a good basis for further development ideas.

In this project, I wanted to create some colorful geometric graphics with Processing platform. I didn't have anything in my mind in particular, so in the end the project had the feature to change the visuals at each mouse click. Think of this as a little push if you want to start with a new project but can't do it. Just play with the code, add stuff, delete stuff, change stuff... Use the empty draw function for example.

The code is here:

/* A pretty basic code for creating randomly generated triangles with random colors.
*  Deniz Saglam, 2013

float alpha = 0.0;
int triangle_count = 40;

void setup()
size(600, 480); //size of canvas, initially 600 x 480. play around with this to see the difference.
background(200); //canvas background
color c = color (0, 0, 0);
for (int iter = 0; iter < triangle_count; iter++) {
alpha = random(100.0, 255.0);
c = color(random(255.0), random(255.0), random(255.0)); //a random color is generated for filling the triangles at each iteration
fill(c, alpha); //triangles are actually filled with the previously generated color, and have an alpha (transparency) value

//this next line can be edited for different visuals.
triangle(random(height), random(height), random(height + height * 0.24), random(height) + random(height + height * 0.24), random(width), random(width + width * 0.133)); //create a new triangle at each iteration

void draw() {

void mouseClicked() {
print("Mouse is clicked. \n");
color c4 = color(random(50.0, 155.0), random(50.0, 155.0), random(50.0, 155.0)); //create new color for background
background(c4); //new random background is colored
color c = color (0, 0, 0);
for (int iter = 0; iter < triangle_count; iter++) {
c = color(random(255.0), random(255.0), random(255.0));
fill(c, random(100.0, 255.0)); // fill the triangles

//this next line can be edited for different visuals.
triangle(random(height), random(height), random(height + height * 0.24), random(height) + random(height + height * 0.24), random(width), random(width + width * 0.133));



‘Project Genesis’ @ Ars Electronica Center


It was very fortunate of me to be able to take part in this exhibition, which is about how synthetical biology, which also focuses on the virtual life that is created in laboratory environment, can affect our future lives.

Our project is about saving digital data into DNA, which enables all of us to save our data for thousands of years, whereas the lifespan of a common harddisk drive is only couple of years. Also this allows us to carry our data at all times, since large stacks of information can be stored in a tablespoon full of DNA. Although the current drawback is cost, it is known that the first transistors were impractically expensive and this might point out that at a certain point in future, we might be able to use DNA as a new medium to save our data. All this process bases on the algorithm of George Church, a molecular biology professor at Harvard Medical School.

My part in this exhibition was to code this algorithm with a GUI in Processing environment and to create a bundle experience for visitors, to type in whatever they like and to print this data out in binary and DNA strings, printed onto a paper.

If you happen to visit the exhibition, please do consider to contribute to our DNA wall, which consists of strings of information that is printed by previous visitors, who sticked their information onto this wall. Collaborative memory!

Now it's time to chill and lean back for a while...


Processing + Twitter by using Twitter4j

Processing Icon

***RESOLVED*** EDIT: I am updating the info of this post with this edit, since it got a bit outdated. First thanks to Codasign people for their awesome tutorial, you can take a look at it here. The current version of Twitter4j is 4.0.1 by the time I am writing this post. Below you can find the working tutorial for using Twitter4j within Processing.

Okay, I know that there are many, many tutorials on this subject and I know that it's fairly easy to actually get some output within 2 hours of googling and copy pasta - however, this is a long road for impatient users like me. Also, I have a project on my mind and I want to share my experience before I get it done.

First of all, please do check this tutorial before getting your hands dirty, because it is simply awesome. I just modified it slightly and I believe it's a wonderful starting point.

One issue about the tutorial for me was the authentication part of the twitter API. Below is my (slightly different yet more practical) version of the steps:

1. Visit and login with your twitter username and password
2. Click on the ‘Create an app’ button at the bottom right
3. Fill out the form that follows.
4. Once you’ve agreed to the developer terms, you’ll arrive at a page which shows the first two of the four things that we need: the Consumer key and the Consumer secret. Copy and paste these somewhere so you have them ready to access.

 4,5. Click on settings button. Scroll down to Application Type and select Read and Write. This is important because otherwise for posting a tweet, you'll need the rights to be able to Write. The code provided on the tutorial will NOT post a tweet to your account.

5. To get the other two values that we need, click on the button that says ‘Create my access token’. Copy and paste those two values (Access token and Access token secret) so that we have all four in the same place. These are pretty important so keep them handy, but don't share them with third parties.

So this was what you had to do with twitter authentication. Now we come to Twitter4j and Processing part. If you haven't done yet, please download Twitter4j and install it from here.

For installing, do the following:
1) Unzip the
2) Move the unzipped folder to Processing > libraries (This is by default inside Documents on Windows)
3) Rename the folder "twitter4j-4.0.1 " to "twitter4j401"
4) Place all contents of the "twitter4j401" folder into a folder called "library", which is inside the "twitter4j401" folder
5) Rename "twitter4j-core-4.0.1.jar" in the "library" folder to "twitter4j401.jar".  This was our final step and now shut down processing if it's still running and relaunch it. Voila!
Now you should have Twitter4j library ready to use in Processing. Open up a Processing sketch, and select Sketch-> Import Library... -> twitter4j401. If you got it all right, you'll see a bunch of import twitter4j... codes in your sketch. Excellent!

For a quick example (provided %99 by Jer from, copy and paste the code below to your Processing sketch and hit Play button. I'm sure that'll help you get started. By the way, do not forget to replace the asterisks with your own tokens you got from

import twitter4j.conf.*;
import twitter4j.internal.async.*;
import twitter4j.internal.logging.*;
import twitter4j.json.*;
import twitter4j.internal.util.*;
import twitter4j.auth.*;
import twitter4j.api.*;
import twitter4j.util.*;
import twitter4j.internal.http.*;
import twitter4j.*;
import twitter4j.internal.json.*;
//Build an ArrayList to hold all of the words that we get from the imported tweets
ArrayList<String> words = new ArrayList();

void setup() {
//Set the size of the stage, and the background to black.

ConfigurationBuilder cb = new ConfigurationBuilder();

//Now we’ll make the main Twitter object that we can use to do pretty much anything you can do on the twitter website
//– get status updates, run search queries, find follower information, etc. This Twitter object gets built by something
//called the TwitterFactory, which needs our configuration information that we set above:
Twitter twitter = new TwitterFactory(;
//Now that we have a Twitter object, we want to build a query to search via the Twitter API for a specific term or phrase.
// This is code that will not always work – sometimes the Twitter API might be down, or our search might not return any results,
//or we might not be connected to the internet. The Twitter object in twitter4j handles those types of conditions by throwing back
//an exception to us; we need to have a try/catch structure ready to deal with that if it happens:
Query query = new Query("#audio");
//Try making the query request.
try {
QueryResult result =;
ArrayList tweets = (ArrayList) result.getTweets();

for (int i = 0; i < tweets.size(); i++) {
Tweet t = (Tweet) tweets.get(i);
String user = t.getFromUser();
String msg = t.getText();
Date d = t.getCreatedAt();
println("Tweet by " + user + " at " + d + ": " + msg);

//Break the tweet into words
String[] input = msg.split(" ");
for (int j = 0; j < input.length; j++) {
//Put each word into the words ArrayList
catch (TwitterException te) {
println("Couldn't connect: " + te);

void draw() {
//Draw a faint black rectangle over what is currently on the stage so it fades over time.

//Draw a word from the list of words that we've built
int i = (frameCount % words.size());
String word = words.get(i);

//Put it somewhere random on the stage, with a random size and colour
text(word, random(width), random(height));


//End of code.


Please feel free to share any problems you confront with.