Thursday, May 9, 2013

Final Project

For my final project in ISTA 401 I designed a program that could visualize data about the crimes that occur in the dorms at the University of Arizona. This particular data was from 2009, the year I happened to live in the dorms. My partner Alex and I made a program that contained a list of all the crimes alongside a map of all the dorms at U of A. Here is a picture of our program being run:

For each crime on the left side there is a corresponding ellipse or 'button' that can be selected or 'activated.' If a crime becomes selected, the program will create a transparent colored circle on the UA map around the corresponding dorm. The map will show the viewer all the dorms that contain instances of these crimes. A physical number appears in the center of the transparent circles that show the count of crime at that location. 
Here is a picture of our program with some crimes selected:

We loaded in a txt file with all the counts of all the crimes at each dorm. We split each value by a comma and created multiple arrays of ints. We created a crime class which draws all the crimes on the left with the button and we also created a CrimeMarker class which puts the transparent circles over the map.

We were trying to take a data set about a particular year of crime inside the University of Arizona dorms and  visualize it in a cool and exciting way. I this was very successful as an interactive data visualization. This visualization could be a useful tool for a group that deals with this type of data every day like the police. Alex and I would eventually want to add more years of data and have the user choose which year he wants to view. One of my other ideas was to use the data to predict where crime might occur in future years.  

My Role:
Alex and I worked really hard on this project. I wrote a lot of the code, including the buttons and list of crimes on the left side. I found the x and y coordinates of each dorm on our map of U of A (to indicate where to draw the circle if that dorm had a crime occur). I created the crime class where it can detect if the mouse is over a crime button and when it is selected. I also made another class called CrimeMarker which draws the transparent circle over the map of dorms. It has the x and y coordinated I recorded earlier and a radius to decide how big the circle would appear on the map (this depended on how many occurrences of a particular crime there are in that dorm). I made sure that each crime was assigned a color. Alex helped me assign the colors based on crime level or type. In all, this was a team effort with a pretty cool turnout!

Wednesday, May 8, 2013

Research Presentation: Minim Library

I wanted to explore and discover more about the Processing library called Minim. It is a fairly easy to use audio library which helps integrate audio into your sketches. I know a lot of people are interested, including me, in creating and editing audio in Processing sketches and knowing more about Minim could be very useful.

Installation
First you should install the Minim library here: http://code.compartmental.net/minim/distro/minim-2.0.2-lib.zip

Replace your existing Minim library that comes with processing with your newly downloaded library.

Restart Processing.

Usage
Here are some cool features that Minim has:


  • AudioPlayer: Mono and Stereo playback of WAV, AIFF, AU, SND, and MP3 files.
  • AudioMetaData: An object filled with metadata about a file, such as ID3 tags.
  • AudioRecorder: Mono and Stereo audio recording either buffered or direct to disk.
  • AudioInput: Mono and Stereo input monitoring.
  • AudioOutput: Mono and Stereo sound synthesis.
  • AudioSignal: A simple interface for writing your own sound synthesis classes.
  • Comes with all the standard waveforms, a pink noise generator and a white noise generator. Additionally, you can extend the Oscillator class for easy implementation of your own periodic waveform.
  • AudioEffect: A simple interface for writing your own audio effects.
  • Comes with low pass, high pass, band pass, and notch filters. Additionally, you can extend the IIRFilter class for easy implementation of your own IIR filters.
  • Easy to attach signals and effects to AudioInputs and AudioOutputs. All the mixing and processing is taken care of for you.
  • Provides an FFT class for doing spectrum analysis.
  • Provides a BeatDetect class for doing beat detection.
Examples
1. Here is some example code that simply shows how to play a audio file with Minim:

[snip java]
import ddf.minim.*;
Minim minim;
AudioPlayer song;
void setup()
{
size(100, 100);
minim = new Minim(this);
// this loads mysong.wav from the data folder
song = minim.loadFile(“mysong.wav”);
song.play();
}
void draw()
{
background(0);
}
void stop()
{
song.close();
minim.stop();
super.stop();
}
[/snip]
2. Here is some example code of how to add a square wave to the output that goes through a low pass filter:
[snip java]
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.effects.*;
Minim minim;
AudioOutput out;
SquareWave square;
LowPassSP lowpass;
void setup()
{
size(512, 200);
minim = new Minim(this);
// get a stereo line out with a sample buffer of 512 samples
out = minim.getLineOut(Minim.STEREO, 512);
// create a SquareWave with a frequency of 440 Hz,
// an amplitude of 1 and the same sample rate as out
square = new SquareWave(440, 1, 44100);
// create a LowPassSP filter with a cutoff frequency of 200 Hz
// that expects audio with the same sample rate as out
lowpass = new LowPassSP(200, 44100);
// now we can attach the square wave and the filter to our output
out.addSignal(square);
out.addEffect(lowpass);
}
void draw()
{
// you might decide to draw the waveform here or do something else
}
// here we provide a way to mute out
// because, let's face it, it's not a very pleasant sound
void keyPressed()
{
if ( key == 'm' )
{
if ( out.isMuted() )
{
out.unmute();
}
else
{
out.mute();
}
}
}
void stop()
{
out.close();
minim.stop();
super.stop();
}
[/snip]

3. This is a link to the code and demonstration of a simple beat detect program that can see when a kick, snare, or hat is played: http://code.compartmental.net/minim/examples/BeatDetect/FrequencyEnergy/
More Info
You can do so much cool stuff with the many features that Minim has to offer. For some more info and even example codes check out the Minim website (http://code.compartmental.net/tools/minim/). If you click on Tools you can see more specific functions within Minim.
This is probably one of the coolest sketches I have seen with Minim: http://motscousus.com/stuff/2008-02_Processing.org_patterns/test_beat.pde

Wednesday, May 1, 2013

Infusing Musical Boundaries

Infusing Musical Boundaries is a music installation I made in my ISTA 401 class. In this installation, the users get to immerse themselves into a musical environment where they can create music with a touch of a button. I synced up all the buttons of the keyboard to a musical loop, whether it is drums, or a beat it will continue to loop until turned off. All sounds can be turned off when needed. We wanted to infuse the ideas of Jazz, Hip-hop and Techno. If you mix and match different genres together it makes a whole new work of art and we wanted to show this through our piece. 

Here are a few screenshots:





Our work is different from others because we take loops that are very available to the public and transform them into a whole new piece that the user can personally create. The visual aspect of our program makes it stand out from the rest. The visuals make our loops more prominent and creates a whole work of art into the piece. With this aspect of the program, the user doesn't necessarily have to be about the music, they can also explore the visuals of the project. Its more of a trial and error to experience the visuals and the music. We programmed it so you can easily extract a sound from many that are playing in case there is something off beat or it does not sound right, there is a lot of power available to the user to select what they want to do.There are a few guidelines but no major rules. It is here to help the creative juices flow. 

This installation was implemented in the 2013 SISTA Art Show! During the Art Show, Marie and I gave a 5-10 minute performance to demonstrate how to use it and we rocked out!