Final Project: Figure dancing to music.

CMPS 161, Spring 2008, UCSC


Reza Haddadi - mhaddadi@ucsc.edu


Description:
For my final project I decided to make an application that reads in a music file and analyses the music extracted from it. A figure will be seen on the screen, it will start dancing to the music when the music starts.

Dividing the tasks:
1. Firstly I will have to decide upon a figure. It does not necessarily need to be a person. It could be a flower digging to the music. But best thing would probably be a stick figure of some kind. So there are many parts of the body that can be manipulated. Different combination of motions could then be connected to different sounds.
2. Secondly I need to set up some animation boundaries for my object. Deformation boxes should be defined for different parts of the object that will be manipulated.
3. Thirdly I have to decide upon how the figure will move. Weather I should connect different sounds to different body parts or create different moves that then will be connected to different sounds.
4. Try different combination of the moves out in combination to see if they fit together. Maybe set up the moves to different keys for testing and also in case the analysis of the music would take to long.
5. Figure out how to load and play music using C++.
6. Figure out how to extract the type of music file that is loaded to analyze its content.
7. Find specific patterns that can be connected to the animation. Maybe just some certain frequency will be connected to some certain move or body part.

Goals:
To be done with the tasks above and document it by Mars 19th.

Planning:
*. Till Friday the 7th I plan to have decided and found a object that I will use for the animation.
*. Beginning of the week after will be dedicated to get up some starter code for the user interface so the figure can be seen. This workspace will be the base of the manipulation.
*. From Wednesday and on I will focus my attention on the animations of the figure.
*. The weekend after till the project is due will be spent on music analysis.


Thoughts before starting the task:
I personally think this project is going to be very hard but exciting. It seems like a lot of fun and it is something interesting I never tried working with before.
But as much as I want to spend time with it I think it will be too little however much I spend on it since it at start seems so hard.
I think it is a good think that I divided the project in smaller tasks so it wont seem to big and unbearable. I feel confident I will at least do the animation part. But when it comes to the analysis of the music it is hard to tell how much time it will take.

Progress:
I thought of many ways of having a object dancing and what parts of the object would be dancing and depending on what. I thought I could maybe have a object like the enterprise with a control cube surrounding it and the control cubes control points binded to a certain frequency range so it would pop in and out. But after some thinking it seemed like the object would be to frenetic.
So I went back to my original though of having a stick figure where it's joints could be connected to ranges of frequencies.

I started of by creating the figure, with the movable body parts in mind. I made the body parts movable by having suiting transfers and rotations so the movements would look as believable as possible.
The movements were then connected to key buttons for test purposes.
Alot of room were added for additional rotates.

I had before hand done research on music analysis library i could use. I had found a really good one for playing the music and one really good one for the analyze of the audio file as well. These can be found here:
http://www.ambiera.com/irrklang/
http://www.mega-nerd.com/libsndfile/
According to their documentation these libraries were prefect for my task and I decided to use them. But I had some real problems with them. Visual studios had a hard time importing the files and I never got it working.
I was close to being done, all I needed to add was for the irrKlang library to read the file and play the music which can be preformed with one command.
The libsndfile library would be used to retrieve the frequency from the audio file when loaded.

Use:
You can rotate the view by scrolling the x,y or z bars on the user interface. You can zoom close and far of the object by scrolling the zoom bar.

Each limb comes with a positive and negative rotation.
These keys are used:
1/q - head rotate X axis
2/w - head rotate Y axis
3/e - head rotate Z axis
4/r - shoulder rotate Y
5/t - right upper arm rotate
6/y - right lower arm rotate
7/u - right hand rotate
8/i - left upper arm rotate
9/o - left lower arm rotate
0/p - left hand rotate
a/z - right upper leg rotate
s/x - right lower leg rotate
d/c - right foot rotate
f/v - left upper leg rotate
g/b - left lower leg rotate
h/n - left foot rotate


Thoughts after the task:
I really tried to make the libraries work with visual study but I had some serious problems that I couldn't solve.
Except for the importing the library I felt I did well with making the figure move appropriately. And everything was set to work as soon as the libraries were to be imported.
I feel bad that did not accomplish my task even tho I tried long and hard to make it work. And I though we had till Saturday to be finished since it said so on the page. So there might be some more cleaning up of the code still needed to be done as well.
But I felt i got better understanding of how translation and rotations can be used appropriately with push and pops. I had to play a lot with the push and pops to make right parts move and make other parts move appropriately with them, like the upper arm moves the under arm with it. And I left a lot of room for making other parts move to. I never really got to make it do cool moves since I spend all most of my time trying to make the library work.
In general I don't feel to bad about it all, I was close to finish my project and I am satisfied with the figure i made.

Screenshots:

Default



Running




The program was developed in C++ on Windows Vista